Submission #220873

# Submission time Handle Problem Language Result Execution time Memory
220873 2020-04-09T07:00:41 Z LorenaMaria Carnival (CEOI14_carnival) C++14
100 / 100
13 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
int n,p[152],x;
vector <int> u;
int main()
{ cin>>n;
  p[1]=1;
  u.push_back(1);
  for(int i=2;i<=n;i++)
  { cout<<u.size()+1<<" ";
    for(int j=0;j<u.size();j++)
      cout<<u[j]<<" ";
    cout<<i<<'\n';
    cin>>x;
    if(x==u.size()+1)
       p[i]=x,u.push_back(i);
  }
  for(int i=1;i<=n;i++)
  { if(p[i])
       continue;
    int st=0,dr=u.size()-1;
    while(st<=dr)
    { int m=(st+dr)/2;
      cout<<m-st+2<<" ";
      for(int j=st;j<=m;j++)
        cout<<u[j]<<" ";
      cout<<i<<'\n';
      cin>>x;
      if(x==m-st+1)
         dr=m-1;
      else
         st=m+1;
    }
    p[i]=p[u[st]];
  }
  cout<<"0 ";
  for(int i=1;i<=n;i++)
    cout<<p[i]<<" ";
  cout<<'\n';
  return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:11:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j=0;j<u.size();j++)
                 ~^~~~~~~~~
carnival.cpp:15:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(x==u.size()+1)
        ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 256 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 9 ms 256 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 11 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 8 ms 256 KB Output is correct
5 Correct 10 ms 256 KB Output is correct
6 Correct 10 ms 256 KB Output is correct
7 Correct 10 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 10 ms 384 KB Output is correct
3 Correct 11 ms 384 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 13 ms 256 KB Output is correct
6 Correct 11 ms 384 KB Output is correct
7 Correct 12 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 8 ms 384 KB Output is correct
3 Correct 9 ms 256 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 11 ms 384 KB Output is correct
6 Correct 10 ms 256 KB Output is correct
7 Correct 12 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 11 ms 384 KB Output is correct
4 Correct 10 ms 384 KB Output is correct
5 Correct 11 ms 256 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 7 ms 384 KB Output is correct