# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1082313 | 2024-08-31T06:45:46 Z | MMihalev | 커다란 상품 (IOI17_prize) | C++14 | 58 ms | 1884 KB |
#include<iostream> #include<vector> #include<algorithm> #include<cmath> #include "prize.h" using namespace std; const int MAX_N=2e5+4; int asked[MAX_N][2]; bool used[MAX_N]; pair<int,int>query(int pos) { if(used[pos])return {asked[pos][0],asked[pos][1]}; used[pos]=1; auto ve=ask(pos); asked[pos][0]=ve[0]; asked[pos][1]=ve[1]; return {ve[0],ve[1]}; } int find_best(int n) { long long N=n; int prevpos=-1; while(1) { prevpos++; if(prevpos>=n)break; auto cur=query(prevpos); long long all=cur.first+cur.second; if(all!=0) { int l=prevpos,r=n-1; while(l<=r) { int mid=(l+r)/2; auto cur2=query(mid); if(cur2.first==cur.first && cur2.second==cur.second) { prevpos=mid; l=mid+1; } else r=mid-1; } } else { return prevpos; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 440 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 484 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 3 ms | 1112 KB | Output is correct |
12 | Correct | 0 ms | 344 KB | Output is correct |
13 | Correct | 4 ms | 1368 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 14 ms | 944 KB | Output is correct |
16 | Incorrect | 58 ms | 1884 KB | Incorrect |
17 | Halted | 0 ms | 0 KB | - |