Submission #672113

#TimeUsernameProblemLanguageResultExecution timeMemory
672113tbzardRarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void move_inside(int i); void move_outside(int i); int press_button(); bool vis[2222]; int min_cardinality(int n){ vector<int> v; for(int i=0;i<n;i++){ move_inside(i); int r = press_button(); if(r == 2) move_outside(i); else{ v.push_back(i); vis[i] = 1; } } int ans = n/(int)v.size(); int lo = 1, hi = ans-1; vector<int> add; int cnt = 0; while(lo <= hi){ int mid = (lo+hi)/2; int r = press_button(); if(mid >= r){ for(int i=0;i<n;i++){ if(vis[i]) continue; move_inside(i); int r = press_button(); if(r == mid+2){ move_outside(i); } else{ vis[i] = 1; add.push_back(i); cnt++; } } } else{ vector<int> out; while(!add.empty()){ int i = add.back(); move_outside(i); vis[i] = 0; add.pop_back(); cnt--; out.push_back(i); int r = press_button(); if(r < mid+2){ break; } } for(int j=0;j<(int)out.size()a;j++){ int i = out[j]; if(vis[i]) continue; move_inside(i); if(r == mid+2){ move_outside(i); } else{ vis[i] = 1; add.push_back(i); cnt++; } } } int cnt = 0; if(cnt < (int)v.size()*mid) ans = mid, hi = mid-1; else lo = mid+1; } return ans; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:59:42: error: expected ';' before 'a'
   59 |             for(int j=0;j<(int)out.size()a;j++){
      |                                          ^
      |                                          ;
insects.cpp:59:42: error: 'a' was not declared in this scope
insects.cpp:59:43: error: expected ')' before ';' token
   59 |             for(int j=0;j<(int)out.size()a;j++){
      |                ~                          ^
      |                                           )
insects.cpp:59:13: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   59 |             for(int j=0;j<(int)out.size()a;j++){
      |             ^~~
insects.cpp:59:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   59 |             for(int j=0;j<(int)out.size()a;j++){
      |                                            ^
insects.cpp:59:44: error: 'j' was not declared in this scope