Submission #1605724
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define fi first #define se second typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;} template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;} int N; int acc[222222]; int A[222222],B[222222]; signed main(){ cin>>N; rep(i,N){ int a,b; cin>>a>>b; A[i]=a;B[i]=b; acc[a]++; acc[b]--; } rep(i,222222-1)acc[i+1]+=acc[i]; int ma=*max_element(acc,acc+222222); int l=INT_MAX,r=INT_MIN; rep(i,222222)if(acc[i]==ma){ chmin(l,i); chmax(r,i); } rep(i,N){ if(A[i]<=l&&l<B[i]&&A[i]<=r&&r<B[i]){ cout<<ma-1<<endl; return 0; } } cout<<ma<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 足ゲームII |
User | latte0119 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1025 Byte |
Status | AC |
Exec Time | 59 ms |
Memory | 4480 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
All | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 3 ms | 3456 KB |
01-02.txt | AC | 2 ms | 3456 KB |
01-03.txt | AC | 2 ms | 3456 KB |
01-04.txt | AC | 3 ms | 3456 KB |
01-05.txt | AC | 56 ms | 4480 KB |
01-06.txt | AC | 56 ms | 4480 KB |
01-07.txt | AC | 56 ms | 4480 KB |
01-08.txt | AC | 56 ms | 4480 KB |
01-09.txt | AC | 56 ms | 4480 KB |
01-10.txt | AC | 2 ms | 3456 KB |
01-11.txt | AC | 58 ms | 4480 KB |
01-12.txt | AC | 56 ms | 4480 KB |
01-13.txt | AC | 56 ms | 4480 KB |
01-14.txt | AC | 56 ms | 4480 KB |
01-15.txt | AC | 3 ms | 3456 KB |
01-16.txt | AC | 57 ms | 4480 KB |
01-17.txt | AC | 56 ms | 4480 KB |
01-18.txt | AC | 56 ms | 4480 KB |
01-19.txt | AC | 56 ms | 4480 KB |
01-20.txt | AC | 3 ms | 3456 KB |
01-21.txt | AC | 57 ms | 4480 KB |
01-22.txt | AC | 57 ms | 4480 KB |
01-23.txt | AC | 57 ms | 4480 KB |
01-24.txt | AC | 48 ms | 4480 KB |
01-25.txt | AC | 2 ms | 3456 KB |
01-26.txt | AC | 2 ms | 3456 KB |
01-27.txt | AC | 57 ms | 4480 KB |
01-28.txt | AC | 59 ms | 4480 KB |
sample-01.txt | AC | 3 ms | 3456 KB |
sample-02.txt | AC | 3 ms | 3456 KB |
sample-03.txt | AC | 3 ms | 3456 KB |