제출 #436223

#제출 시각아이디문제언어결과실행 시간메모리
436223Belgutei버섯 세기 (IOI20_mushrooms)C++17
55.53 / 100
15 ms328 KiB
#include "mushrooms.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define pb push_back #define mk make_pair int ans=1; vector<int> v,v1; int count_mushrooms(int n) { v.pb(0); for(int i=1; i<n && i<250; i++){ vector<int> tur; tur.clear(); tur.pb(0); tur.pb(i); int val=use_machine(tur); if(val==0) v.pb(i),ans++; else v1.pb(i); } if(n<=250) return ans; if(v.size()>v1.size()){ int i=250; while(i<n){ vector<int> tur; tur.clear(); int pos=0; while(pos<v.size() && i<n){ tur.pb(v[pos]); tur.pb(i); i++; pos++; } int val=use_machine(tur); ans+=pos-(val+1)/2; } } else{ int i=250; while(i<n){ vector<int> tur; tur.clear(); int pos=0; while(pos<v1.size() && i<n){ tur.pb(v1[pos]); tur.pb(i); i++; pos++; } int val=use_machine(tur); ans+=(val+1)/2; } } return ans; //int c2 = use_machine(m); }

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

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:33:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |    while(pos<v.size() && i<n){
      |          ~~~^~~~~~~~~
mushrooms.cpp:49:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |    while(pos<v1.size() && i<n){
      |          ~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...