# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
44418 |
2018-04-02T05:17:40 Z |
wzy |
Carnival (CEOI14_carnival) |
C++11 |
|
14 ms |
588 KB |
#include <bits/stdc++.h>
using namespace std;
int c[160];
int dp[160][160];
int n ;
int query(int l , int r){
if(l == r) return 1;
cout<<(r - l + 1)<<" ";
for(int i = l ; i <= r ;i ++){
cout<<i<<" ";
}
cout<<endl;
int x;
cin>>x;
return x;
}
int main(){
cin>>n;
for(int i = 1 ; i <=n ; i++){
c[i] = i;
if(i == 1){
dp[i][i] = 1;
for(int j = 2 ; j <= n ; j++){
cout<<(j - i + 1)<<" ";
for(int w = 1 ; w <= j ; w++){
cout<<w<<" ";
}
cout<<endl;
cin>>dp[i][j];
}
}
else{
int ansj = - 1;
int l = i , r = n;
while(l<= r){
int mid = (l+r)/2;
if(dp[i-1][mid] == query(i , mid)){
r = mid - 1;
ansj = mid;
}
else{
l = mid + 1;
}
}
if(ansj == -1){
for(int w = i ; w <= n ; w++){
dp[i][w] = dp[i-1][w] - 1;
}
}
else{
for(int w = i ; w <=n ; w++){
if(w < ansj) dp[i][w] = dp[i-1][w] - 1;
else dp[i][w] = dp[i-1][w];
}
}
}
}
for(int i =1 ; i <= n - 1 ;i ++){
for(int j = i + 1 ; j <= n ; j ++){
if(dp[i][j] == dp[i+1][j]){
c[j ] = c[i];
break;
}
}
}
cout<<0<<" ";
for(int i = 1 ; i <= n; i ++){
cout<<c[i]<<" ";
}
cout<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
376 KB |
Integer 19 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
436 KB |
Integer 6 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
436 KB |
Output is correct |
2 |
Incorrect |
7 ms |
444 KB |
Integer 11 violates the range [1, 8] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
452 KB |
Integer 5 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
588 KB |
Output is correct |
2 |
Incorrect |
12 ms |
588 KB |
Integer 20 violates the range [1, 17] |
3 |
Halted |
0 ms |
0 KB |
- |