제출 #388048

#제출 시각아이디문제언어결과실행 시간메모리
388048Supersonic버섯 세기 (IOI20_mushrooms)C++14
25 / 100
148 ms496 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; int count_mushrooms(int n) { int k=20001; vector<int> a;vector<int> b;a.push_back(0); int r1=use_machine({0,1});if(r1)b.push_back(1);else a.push_back(1); if(n==2)return a.size(); int r2=use_machine({0,2});if(r2)b.push_back(2);else a.push_back(2); if(n==3)return a.size(); int c=3; if(a.size()>=2){ while(c<n-1&&max(a.size(),b.size())<k){ r1=use_machine({a[0],c,a[1],c+1}); if(r1==0){a.push_back(c);a.push_back(c+1);} if(r1==1){a.push_back(c);b.push_back(c+1);} if(r1==2){b.push_back(c);a.push_back(c+1);} if(r1==3){b.push_back(c);b.push_back(c+1);} c+=2; } } else{ while(c<n-1&&max(a.size(),b.size())<k){ r1=use_machine({b[0],c,b[1],c+1}); if(r1==0){b.push_back(c);b.push_back(c+1);} if(r1==1){b.push_back(c);a.push_back(c+1);} if(r1==2){a.push_back(c);b.push_back(c+1);} if(r1==3){a.push_back(c);a.push_back(c+1);} c+=2; } } if(c==n-1){ if(use_machine({0,n-1})==1)b.push_back(n-1); else a.push_back(n-1); c++; } if(c==n)return a.size(); return 0; }

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

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:13:38: warning: comparison of integer expressions of different signedness: 'const long unsigned int' and 'int' [-Wsign-compare]
   13 |   while(c<n-1&&max(a.size(),b.size())<k){
      |                ~~~~~~~~~~~~~~~~~~~~~~^~
mushrooms.cpp:23:38: warning: comparison of integer expressions of different signedness: 'const long unsigned int' and 'int' [-Wsign-compare]
   23 |   while(c<n-1&&max(a.size(),b.size())<k){
      |                ~~~~~~~~~~~~~~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...