제출 #607570

#제출 시각아이디문제언어결과실행 시간메모리
607570keta_tsimakuridze버섯 세기 (IOI20_mushrooms)C++14
0 / 100
0 ms208 KiB
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
	vector<int> A, B, x;
	A.push_back(0);
	int cntA = 1;
	while(x.size()) {
        if(A.size() >= B.size()) {
            vector<int> v;
            int nn = 0;
            for(int i = 0; i < A.size(); i++) {
                v.push_back(A[i]);
                v.push_back(x.back());
                x.pop_back(); ++nn;
                if(!x.size()) break;
            }
            int x = use_machine(v);
            cntA += nn - (x / 2 + x % 2);
            if(x % 2) B.push_back(v.back());
            else A.push_back(v.back());
        } else {
            vector<int> v;
            int nn = 0;
            for(int i = 0; i < B.size(); i++) {
                v.push_back(B[i]);
                v.push_back(x.back());
                x.pop_back(); ++nn;
                if(!x.size()) break;
            }
            int x = use_machine(v);
            cntA += (x / 2 + x % 2);
            if(x % 2 == 0) B.push_back(v.back());
            else A.push_back(v.back());
        }
	}
	return cntA;
}

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

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