# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
111803 | 2019-05-16T08:18:35 Z | Mercenary | 쌀 창고 (IOI11_ricehub) | C++14 | 19 ms | 1792 KB |
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; bool Chk(int X[] , int R , ll B , int ask){ int l = 0 , h = ask - 1; ll sum = 0; ll suml = 0; for(int i = 0 ; i < ask ; ++i){ sum += X[i]; if(i <= (l + h) / 2)suml += X[i]; } while(true){ // cerr << ask << " " << sum << " " << suml << endl; if((ask % 2) * (ll)X[(l + h) / 2] + sum - 2 * suml <= B)return 1; if(h == R - 1)break; sum += -X[l] + X[h + 1]; suml += -X[l] + X[(l + h) / 2 + 1]; ++l;++h; } return 0; } int besthub(int R, int L, int X[], long long B) { int l = 1; int h = R + 1; while(l <= h){ ll mid = l + h >> 1; if(Chk(X , R , B , mid))l = mid + 1; else h = mid - 1; } // cerr << Chk(X,R,B,4); return h; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 356 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 128 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Incorrect | 2 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Incorrect | 3 ms | 256 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 5 ms | 512 KB | Output is correct |
3 | Incorrect | 19 ms | 1792 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |