Submission #750277

# Submission time Handle Problem Language Result Execution time Memory
750277 2023-05-29T09:25:42 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
9 ms 316 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair< int, int > ii;
typedef pair< int, ii > iii;
typedef vector< int > vi;
typedef vector< ii > vii;
typedef vector< iii > viii;
typedef vector< vi > vvi;
typedef vector< vii > vvii;
typedef vector< viii > vviii;
#define hdp 1e9+7
#define MAX LLONG_MAX
#define st first
#define nd second

const int N = 155;
vi st;
int color[N];

int pro(int n){
    int l = 0, r = st.size() - 1;
    while(l < r){
        int m = (l + r) / 2;
        cout << m + 2 << ' ' << n << ' ';
        for(int i=0; i<=m; i++) cout << st[i] << ' ';
        cout << endl;
        int ans; cin >> ans;
        
        if(ans == m + 1) r = m;
        else l = m + 1;
    }
    return color[st[l]];
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n; cin >> n;
	for(int i=1; i<=n; i++){
	    cout << i << ' ';
	    for(int j=1; j<=i; j++) cout << j << ' ';
	    cout << endl;
	    int ans; cin >> ans;
	    
	    if(ans == st.size() + 1){ 
	        st.push_back(i);
	        color[i] = st.size();
	    }
	    else color[i] = pro(i);
	}
	cout << 0 << ' ';
	for(int i=1; i<=n; i++) cout << color[i] << ' ';
	cout << endl;
} 

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:49:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |      if(ans == st.size() + 1){
      |         ~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 7 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 3 ms 316 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 9 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 3 ms 208 KB Output is correct