Submission #547727

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5477272022-04-11 14:33:19LucaDantasCounting Mushrooms (IOI20_mushrooms)C++17
94.96 / 100
10 ms392 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
constexpr int repeticoes = 80;
int qtd_min = 170;
vector<int> color[2];
int count_mushrooms(int N) {
qtd_min = min(qtd_min, N);
int cnt[2]{};
color[0] = {0};
vector<int> unknown(N-1);
iota(unknown.begin(), unknown.end(), 1);
bool foi = 0;
while(unknown.size()) {
int usar = color[1].size() > color[0].size(); // escolho o grupo que tem mais gente pra usar
int sz = color[usar].size();
if(sz == 2 && !foi) {
foi = 1;
for(; (max(color[0].size(), color[1].size()) < 3 || min(color[0].size(), color[1].size()) < 2)
&& color[0].size() + color[1].size() < qtd_min && unknown.size() > 2;) {
vector<int> qr;
for(int i = 0; i < 2; i++, unknown.pop_back())
qr.push_back(color[usar][i]), qr.push_back(unknown.back());
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:26:43: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |      && color[0].size() + color[1].size() < qtd_min && unknown.size() > 2;) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
mushrooms.cpp:43:48: warning: comparison of integer expressions of different signedness: 'const long unsigned int' and 'int' [-Wsign-compare]
   43 |    for(; max(color[0].size(), color[1].size()) < qtd_min && unknown.size() >= 5;) {
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...