Submission #842415

#TimeUsernameProblemLanguageResultExecution timeMemory
842415vxxwuCarnival (CEOI14_carnival)C++17
100 / 100
6 ms952 KiB
#include <iostream> #include <vector> #include <algorithm> #include <tuple> using namespace std; #define MAXN 150 #define ll long long #define int ll #define max max<int> #define min min<int> #define f first #define s second typedef pair<int, int> pii; int costume[MAXN+1]; int costume_pointer[MAXN+1]; int costumes=1; int diff; void binary_search(vector<int> query, int index){ vector<int> temp; for(int i=0; i<query.size()/2; i++){ temp.emplace_back(query[i]); } cout<<temp.size()+1<<" "; for(int j:temp){ cout<<j<<" "; } cout<<index<<endl; cin>>diff; if(diff==temp.size()){ if(diff==1){ costume[index]=costume[temp[0]]; return; } binary_search(temp, index); return; } temp.clear(); for(int i=query.size()/2; i<query.size(); i++){ temp.emplace_back(query[i]); } cout<<temp.size()+1<<" "; for(int j:temp){ cout<<j<<" "; } cout<<index<<endl; cin>>diff; if(diff==temp.size()){ if(diff==1){ costume[index]=costume[temp[0]]; return; } binary_search(temp, index); return; } } int32_t main() { // freopen("split.in", "r", stdin); // freopen("split.out", "w", stdout); int n; cin>>n; costume[1]=1; costume_pointer[1]=1; for(int i=2; i<=n; i++) { vector<int> query; for(int j=1; j<=costumes; j++){ query.emplace_back(costume_pointer[j]); } cout<<costumes+1<<" "; for(int j:query){ cout<<j<<" "; } cout<<i<<endl; cin>>diff; if(diff==costumes+1){ costumes++; costume[i]=costumes; costume_pointer[costumes]=i; continue; } else{ binary_search(query, i); } } cout<<0<<" "; for(int i=1; i<=n; i++){ cout<<costume[i]<<" "; } cout<<endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'void binary_search(std::vector<long long int>, long long int)':
carnival.cpp:25:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=0; i<query.size()/2; i++){
      |                  ~^~~~~~~~~~~~~~~
carnival.cpp:35:12: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     if(diff==temp.size()){
      |        ~~~~^~~~~~~~~~~~~
carnival.cpp:45:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for(int i=query.size()/2; i<query.size(); i++){
      |                               ~^~~~~~~~~~~~~
carnival.cpp:55:12: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     if(diff==temp.size()){
      |        ~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...