# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
36409 | 2017-12-08T17:28:27 Z | mohammad_kilani | 사육제 (CEOI14_carnival) | C++14 | 43 ms | 3188 KB |
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define oo 2000000000 const int N = 300010; int num[N]; int ask(int l,int r){ if(r == l) return 1; printf("%d",r-l+1); for(int i=l;i<=r;i++) printf(" %d",i); puts(""); fflush(stdout); int res ; scanf("%d",&res); return res; } int main() { //freopen("in.txt","r",stdin); int n , cnt = 1; scanf("%d",&n); for(int i=1;i<=n;i++){ if(num[i] == 0){ num[i] = cnt++; } int low = i + 1, high = n , res = i; while(high >= low){ int mid = (low + high) / 2; int cur = ask(i,mid); int cur2 = ask(i+1,mid); if(cur == cur2){ res = mid; high = mid - 1; } else{ low = mid + 1; } } num[res] = num[i]; } putchar('0'); for(int i=1;i<=n;i++) printf(" %d",num[i]); puts(""); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 3188 KB | Output is correct |
2 | Correct | 19 ms | 3188 KB | Output is correct |
3 | Correct | 9 ms | 3188 KB | Output is correct |
4 | Correct | 16 ms | 3188 KB | Output is correct |
5 | Correct | 3 ms | 3188 KB | Output is correct |
6 | Correct | 26 ms | 3188 KB | Output is correct |
7 | Correct | 13 ms | 3188 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 3188 KB | Output is correct |
2 | Correct | 13 ms | 3188 KB | Output is correct |
3 | Correct | 19 ms | 3188 KB | Output is correct |
4 | Correct | 9 ms | 3188 KB | Output is correct |
5 | Correct | 9 ms | 3188 KB | Output is correct |
6 | Correct | 13 ms | 3188 KB | Output is correct |
7 | Correct | 6 ms | 3188 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3188 KB | Output is correct |
2 | Correct | 13 ms | 3188 KB | Output is correct |
3 | Correct | 43 ms | 3188 KB | Output is correct |
4 | Correct | 19 ms | 3188 KB | Output is correct |
5 | Correct | 9 ms | 3188 KB | Output is correct |
6 | Correct | 6 ms | 3188 KB | Output is correct |
7 | Correct | 23 ms | 3188 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 3188 KB | Output is correct |
2 | Correct | 9 ms | 3188 KB | Output is correct |
3 | Correct | 16 ms | 3188 KB | Output is correct |
4 | Correct | 26 ms | 3188 KB | Output is correct |
5 | Correct | 3 ms | 3188 KB | Output is correct |
6 | Correct | 19 ms | 3188 KB | Output is correct |
7 | Correct | 6 ms | 3188 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 3188 KB | Output is correct |
2 | Correct | 23 ms | 3188 KB | Output is correct |
3 | Correct | 13 ms | 3188 KB | Output is correct |
4 | Correct | 9 ms | 3188 KB | Output is correct |
5 | Correct | 9 ms | 3188 KB | Output is correct |
6 | Correct | 23 ms | 3188 KB | Output is correct |
7 | Correct | 26 ms | 3188 KB | Output is correct |