제출 #106187

#제출 시각아이디문제언어결과실행 시간메모리
106187OpenTheWindowGap (APIO16_gap)C++14
30 / 100
70 ms2428 KiB
#include<iostream> #include<string> #include<set> #include<utility> #include<vector> #include<map> #include<algorithm> #include<queue> #include<stack> #include"gap.h" using namespace std; long long findGap(int T, int N){ long long ans = 0; if(T == 1){ vector<long long> a; long long s = 0, t = 1000000000000000000LL; while (true) { long long mn, mx; if(a.size() == N) break; if(s > t) break; MinMax(s, t, &mn, &mx); if(mn == -1) break; if(mn < mx){ a.push_back(mn); a.push_back(mx); s = mn + 1; t = mx - 1; } if(mn == mx){ a.push_back(mn); break; } } sort(a.begin(), a.end()); ans = 0; for(int i=0; i<N-1; i++){ ans = max(ans, a[i+1] - a[i]); } } else{ vector<long long> a; long long ms = 0, mt = 1000000000000000000LL; long long mn, mx; MinMax(ms, mt, &mn, &mx); a.push_back(mn); a.push_back(mx); long long s = mn + 1, t = mn + 2; while (true) { if(a.size() == N) break; MinMax(s, t, &mn, &mx); if(mn < mx){ a.push_back(mn); a.push_back(mx); } if(mn == mx){ a.push_back(mn); } s = t + 1; t = s + 2; } sort(a.begin(), a.end()); ans = 0; for(int i=0; i<N-1; i++){ ans = max(ans, a[i+1] - a[i]); } } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(a.size() == N) break;
       ~~~~~~~~~^~~~
gap.cpp:73:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(a.size() == N) break;
       ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...