Submission #1152192
Source Code Expand
#include<bits/stdc++.h> #define N 100001 #define P pair<int,int> using namespace std; P k[N]; int a[N]; signed main(){ int b;scanf("%d",&b); for(int c=0;c<b;c++){ int d,e;scanf("%d%d",&d,&e);d--;e--;//(d,e] k[c]=P(d,e); a[d]++;a[e]--; } int MAX=0; int s=0; for(int c=0;c<N;c++){ s+=a[c]; a[c]=s; MAX=max(MAX,s); } int x=0,y=N-1; for(;x<N;x++){ if(a[x]==MAX)break; } for(;y>=0;y--){if(a[y]==MAX)break;} cout<<x<<" "<<y<<" "<<MAX<<endl; for(int i=0;i<b;i++){ if(k[i].first<=x&&k[i].second>y){cout<<MAX-1<<endl;return 0;} } cout<<MAX<<endl; }
Submission Info
Submission Time | |
---|---|
Task | D - 足ゲームII |
User | naoki2016 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 629 Byte |
Status | WA |
Exec Time | 19 ms |
Memory | 1408 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:9:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int b;scanf("%d",&b); ^ ./Main.cpp:11:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int d,e;scanf("%d%d",&d,&e);d--;e--;//(d,e] ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 2 ms | 640 KB |
01-02.txt | WA | 2 ms | 640 KB |
01-03.txt | WA | 2 ms | 640 KB |
01-04.txt | WA | 2 ms | 640 KB |
01-05.txt | WA | 18 ms | 1408 KB |
01-06.txt | WA | 18 ms | 1408 KB |
01-07.txt | WA | 18 ms | 1408 KB |
01-08.txt | WA | 18 ms | 1408 KB |
01-09.txt | WA | 18 ms | 1408 KB |
01-10.txt | WA | 2 ms | 640 KB |
01-11.txt | WA | 18 ms | 1408 KB |
01-12.txt | WA | 18 ms | 1408 KB |
01-13.txt | WA | 18 ms | 1408 KB |
01-14.txt | WA | 18 ms | 1408 KB |
01-15.txt | WA | 2 ms | 640 KB |
01-16.txt | WA | 18 ms | 1408 KB |
01-17.txt | WA | 18 ms | 1408 KB |
01-18.txt | WA | 18 ms | 1408 KB |
01-19.txt | WA | 18 ms | 1408 KB |
01-20.txt | WA | 2 ms | 640 KB |
01-21.txt | WA | 19 ms | 1408 KB |
01-22.txt | WA | 19 ms | 1408 KB |
01-23.txt | WA | 19 ms | 1408 KB |
01-24.txt | WA | 17 ms | 1408 KB |
01-25.txt | WA | 2 ms | 640 KB |
01-26.txt | WA | 2 ms | 640 KB |
01-27.txt | WA | 18 ms | 1408 KB |
01-28.txt | WA | 18 ms | 1408 KB |
sample-01.txt | WA | 2 ms | 640 KB |
sample-02.txt | WA | 2 ms | 640 KB |
sample-03.txt | WA | 2 ms | 640 KB |