제출 #590158

#제출 시각아이디문제언어결과실행 시간메모리
590158almothana05버섯 세기 (IOI20_mushrooms)C++14
0 / 100
2 ms208 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; vector<int>comp , a, b , cmp , erg;; int count_mushrooms(int menge) { int rechner = 0 , numm , pl , nummer; a.push_back(0); for(int i = 1 ; i < min(menge , 200) ; i++){ if(i <= 2 || i == min(menge , 200) - 1){ comp = {0 , i}; if(use_machine(comp) == 0){ a.push_back(i); } else{ b.push_back(i); } } else if(a.size() > 1){ comp = {i , a[0] , i + 1, a[1]}; nummer = use_machine(comp); if(nummer % 2 == 1){ b.push_back(i); } else{ a.push_back(i); } if(nummer > 1){ b.push_back(i + 1); } else{ a.push_back(i + 1); } i++; } else{ comp = {i , b[0] , i + 1 , b[1]}; nummer = use_machine(comp); if(nummer % 2 == 1){ a.push_back(i); } else{ b.push_back(i); } if(nummer > 1){ a.push_back(i + 1); } else{ b.push_back(i + 1); } i++; } } if(menge <= 200){ return a.size(); } // cout << cmp.size() for(int i = 200 ; i < menge ; i = i ){ if(a.size() > b.size()){ numm = i + a.size(); pl = 0; // cout << i << " ja\n"; while(i < min(menge , numm)){ erg.push_back(i); erg.push_back(a[pl]); pl++; i++; } nummer = use_machine(erg); numm = 0; if(nummer % 2 == 1){ numm++; b.push_back(i); } else{ a.push_back(i); } numm += nummer / 2; erg.clear(); rechner += (pl - numm); } else{ numm = i + b.size(); pl = 0; // cout << i << " ja\n"; while(i < min(menge , numm)){ erg.push_back(i); erg.push_back(b[pl]); pl++; i++; } nummer = use_machine(erg); numm = 0; if(nummer % 2 == 1){ // numm++; a.push_back(i); } else{ b.push_back(i); } numm += nummer / 2; erg.clear(); rechner += numm; } } return rechner + a.size(); }
#Verdict Execution timeMemoryGrader output
Fetching results...