제출 #817006

#제출 시각아이디문제언어결과실행 시간메모리
817006RecursiveCo구경하기 (JOI13_watching)C++14
0 / 100
1 ms344 KiB
// CF template, version 3.0 #include <bits/stdc++.h> using namespace std; #define improvePerformance ios_base::sync_with_stdio(false); cin.tie(0) #define getTest int t; cin >> t #define eachTest for (int _var=0;_var<t;_var++) #define get(name) int (name); cin >> (name) #define out(o) cout << (o) #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); } #define sortl(name) sort((name).begin(), (name).end()) #define rev(name) reverse((name).begin(), (name).end()) #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++) #define decision(b) if (b){out("YES");}else{out("NO");} #define int long long int signed main() { improvePerformance; get(n); get(p); get(q); getList(n, nums); sortl(nums); int l = 1; int r = 2e9; while (r - l >= 1) { int middle = (l + r) / 2; int small = p; int large = q; int ptr = 0; bool can = true; while (ptr < n) { if (small + large == 0) { can = false; break; } int newptr = ptr; while (newptr < n && nums[newptr] < nums[ptr] + middle) newptr++; if (newptr == n) { break; } if (nums[newptr] < nums[ptr] + 2 * middle && large) { large--; while (newptr < n && nums[newptr] < nums[ptr] + 2 * middle) newptr++; ptr = newptr; } else { small--; ptr = newptr; } } if (!can) l = middle + 1; else r = middle; } out(l); }

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

watching.cpp: In function 'int main()':
watching.cpp:10:23: warning: unnecessary parentheses in declaration of 'n' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
watching.cpp:23:5: note: in expansion of macro 'get'
   23 |     get(n);
      |     ^~~
watching.cpp:10:23: warning: unnecessary parentheses in declaration of 'p' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
watching.cpp:24:5: note: in expansion of macro 'get'
   24 |     get(p);
      |     ^~~
watching.cpp:10:23: warning: unnecessary parentheses in declaration of 'q' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
watching.cpp:25:5: note: in expansion of macro 'get'
   25 |     get(q);
      |     ^~~
watching.cpp:12:40: warning: unnecessary parentheses in declaration of 'nums' [-Wparentheses]
   12 | #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
      |                                        ^
watching.cpp:26:5: note: in expansion of macro 'getList'
   26 |     getList(n, nums);
      |     ^~~~~~~
watching.cpp:10:23: warning: unnecessary parentheses in declaration of 'a' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
watching.cpp:12:76: note: in expansion of macro 'get'
   12 | #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
      |                                                                            ^~~
watching.cpp:26:5: note: in expansion of macro 'getList'
   26 |     getList(n, nums);
      |     ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...