제출 #385170

#제출 시각아이디문제언어결과실행 시간메모리
385170Ahmadsm2005버섯 세기 (IOI20_mushrooms)C++14
0 / 100
1 ms364 KiB
#include<bits/stdc++.h> #include "mushrooms.h" using namespace std; ///Square ROOT 142 vector<int>REM; vector<int>A,B; int LAST; int count_mushrooms(int n){ vector<int>m; A.push_back(0); m.push_back(0),m.push_back(1); if(use_machine(m)) B.push_back(1); else A.push_back(0); if(n==2){ return A.size(); } m.pop_back(),m.push_back(2); if(use_machine(m)) B.push_back(1); else A.push_back(0); for(int i=3;i<n;i+=2){ vector<int>TEMP; if(A.size()==143||B.size()==143){ LAST=i; break; } if(i+1==n){ TEMP.push_back(0),TEMP.push_back(i); if(use_machine(TEMP)) B.push_back(1); else A.push_back(0); return A.size(); } if(A.size()>=2){ TEMP.push_back(A[0]),TEMP.push_back(i),TEMP.push_back(A[1]),TEMP.push_back(i+1); int ANS=use_machine(TEMP); if(!ANS) A.push_back(i),A.push_back(i+1); else if(ANS==1) A.push_back(i),B.push_back(i+1); else if(ANS==2) A.push_back(i+1),B.push_back(i); else B.push_back(i),B.push_back(i+1); } else{ TEMP.push_back(B[0]),TEMP.push_back(i),TEMP.push_back(B[1]),TEMP.push_back(i+1); int ANS=use_machine(TEMP); if(!ANS) B.push_back(i),B.push_back(i+1); else if(ANS==1) B.push_back(i),A.push_back(i+1); else if(ANS==2) B.push_back(i+1),A.push_back(i); else A.push_back(i),A.push_back(i+1); } } bool SWAP=0; int AA=0; AA=A.size(); if(B.size()>=143) A=B,SWAP=1; for(int l=LAST;l<n;l+=141){ vector<int>LIST,TEMP; for(int x=l;x<min(n,LAST+141);x++){ LIST.push_back(x); } TEMP.push_back(A[0]); for(int i=0;i<LIST.size();i++){ TEMP.push_back(LIST[i]); TEMP.push_back(A[i+1]); } TEMP.push_back(A[LIST.size()]); if(SWAP) AA+=use_machine(TEMP)/2; else AA+=(LIST.size()-use_machine(TEMP)/2); } return AA; }

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

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:74:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 | for(int i=0;i<LIST.size();i++){
      |             ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...