Submission #1237309

#TimeUsernameProblemLanguageResultExecution timeMemory
1237309CyberCowRarest Insects (IOI22_insects)C++20
10 / 100
96 ms420 KiB
#include "insects.h" #include <vector> #include <random> #include <algorithm> using namespace std; mt19937 rnd(5342); //void move_inside(int i) // //void move_outside(int i) // //int press_button() int min_cardinality(int N) { vector<int> v; for (int i = 0; i < N; i++) { v.push_back(i); } shuffle(v.begin(), v.end(), rnd); for (int i = 0; i < v.size(); i++) { move_inside(i); } int skzb = press_button(); int taza; int st = 1; while (st) { for (int i = 0; i < v.size(); i++) { move_outside(v[i]); int yntac = press_button(); if (yntac != skzb) { vector<int> vv; vv.push_back(i); move_inside(v[i]); for (int j = i + 1; j < v.size(); j++) { move_outside(v[j]); int qaqul = press_button(); if (qaqul != skzb) { vv.push_back(j); } move_inside(v[j]); if (vv.size() == skzb) break; } for (int j = 0; j < i; j++) { move_inside(v[j]); } for (int j = vv.size() - 1; j >= 0; j--) { move_outside(v[vv[j]]); swap(v[vv[j]], v.back()); v.pop_back(); } taza = press_button(); if (taza == 0) { return skzb; } if (taza == 1) { return 1; } skzb = taza; break; } } } }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:76:1: warning: control reaches end of non-void function [-Wreturn-type]
   76 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...