제출 #608185

#제출 시각아이디문제언어결과실행 시간메모리
608185rrrr10000콤보 (IOI18_combo)C++14
100 / 100
61 ms564 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<P> vp; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define REP(i,k,n) for(ll i=(ll)(k);i<(ll)(n);i++) #define all(a) a.begin(),a.end() #define pb emplace_back #define fi first #define se second template<class T> void out(T a){cout<<a<<endl;} std::string guess_sequence(int N) { string tmp="ABXY"; ll st; if(press("AB")==0){ if(press("X")==0)st=3; else st=2; } else{ if(press("A")==0)st=1; else st=0; } vi al(1); auto ask=[&](vvi v){ string t; rep(i,v.size()){ rep(j,al.size())t+=tmp[(st+al[j])%4]; rep(j,v[i].size())t+=tmp[(st+v[i][j])%4]; } return press(t); }; while(al.size()<N-1){ ll res=ask({{1,1},{2,1},{2,3}}); if(res==al.size())al.pb(3); else if(res==al.size()+1){ ll res2=ask({{1,2}}); if(res2==al.size()){ al.pb(2);al.pb(2); } else if(res2==al.size()+1){ al.pb(1);al.pb(3); } else if(res2==al.size()+2){ al.pb(1);al.pb(2); } } else if(res==al.size()+2){ ll res2=ask({{2,1}}); if(res2==al.size()){ al.pb(1);al.pb(1); } else if(res2==al.size()+1){ al.pb(2);al.pb(3); } else if(res2==al.size()+2){ al.pb(2);al.pb(1); } } } if(al.size()==N-1){ if(ask({{1}})==N)al.pb(1); else if(ask({{2}})==N)al.pb(2); else al.pb(3); } string res; rep(i,N)res+=tmp[(st+al[i])%4]; return res; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:20: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |     while(al.size()<N-1){
      |           ~~~~~~~~~^~~~
combo.cpp:40:15: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if(res==al.size())al.pb(3);
      |            ~~~^~~~~~~~~~~
combo.cpp:41:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         else if(res==al.size()+1){
      |                 ~~~^~~~~~~~~~~~~
combo.cpp:43:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             if(res2==al.size()){
      |                ~~~~^~~~~~~~~~~
combo.cpp:46:25: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |             else if(res2==al.size()+1){
      |                     ~~~~^~~~~~~~~~~~~
combo.cpp:49:25: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |             else if(res2==al.size()+2){
      |                     ~~~~^~~~~~~~~~~~~
combo.cpp:53:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |         else if(res==al.size()+2){
      |                 ~~~^~~~~~~~~~~~~
combo.cpp:55:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             if(res2==al.size()){
      |                ~~~~^~~~~~~~~~~
combo.cpp:58:25: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |             else if(res2==al.size()+1){
      |                     ~~~~^~~~~~~~~~~~~
combo.cpp:61:25: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |             else if(res2==al.size()+2){
      |                     ~~~~^~~~~~~~~~~~~
combo.cpp:66:17: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   66 |     if(al.size()==N-1){
      |        ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...