제출 #800532

#제출 시각아이디문제언어결과실행 시간메모리
800532FEDIKUS버섯 세기 (IOI20_mushrooms)C++17
0 / 100
2 ms240 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; const int maxn=20010; int count_mushrooms(int n) { vector<int> aovi; vector<int> bovi; int w=100; int ret=0; for(int i=1;i<n;i++){ if(aovi.size()>=w){ vector<int> tmp; for(int j=i;j<min(i+w,n);j++){ tmp.push_back(aovi[j-i]); tmp.push_back(j); } int klkb=use_machine(tmp); klkb=klkb/2+(klkb&1); int klka=tmp.size()/2-klkb; ret+=klka; i+=w-1; continue; } /*if(bovi.size()>=w){ vector<int> tmp; for(int j=i;j<min(i+w,n);j++){ tmp.push_back(bovi[j-i]); tmp.push_back(j); } int klka=use_machine(tmp); klka=klka/2+(klka&1); ret+=klka; i+=w-1; continue; }*/ if(use_machine({0,i})==0) aovi.push_back(i); else bovi.push_back(i); ret=aovi.size(); if(aovi.size()>=w || bovi.size()>=w) break; } return ret+1; }

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

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:14:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |   if(aovi.size()>=w){
      |      ~~~~~~~~~~~^~~
mushrooms.cpp:42:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |   if(aovi.size()>=w || bovi.size()>=w) break;
      |      ~~~~~~~~~~~^~~
mushrooms.cpp:42:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |   if(aovi.size()>=w || bovi.size()>=w) break;
      |                        ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...