제출 #631745

#제출 시각아이디문제언어결과실행 시간메모리
631745AmirElarbi드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include "insects.h" #include <bits/stdc++.h> #define ve vector #define vi ve<int> #define ii pair<int,int> #define ll long long #define vvi ve<vi> #define se second #define fi first #define pb push_back using namespace std; const int nax = 2e3+5; const int MOD = 1e9+7; int pref[nax]; int min_cardinality(int n) { int type = 0; for (int i = 0; i < n; ++i) { move_inside(i); int a = press_button(); if(a == 1) type++; else move_outside(i); pref[i] = type; } for (int i = 0; i < n; ++i) { move_outside(i); } int l = 1,r = (n+1)/type, ans = 0; vi cur; while(l< r){ int md = (l+r)/2; int nb = 0; for (int i = 0; i < n; ++i) { if(vis[i]) continue; move_inside(i); int a = press_button(); if(a > md){ move_outside(i); } else { nb++; cur.pb(i); } } if(type*md == nb){ for(auto x : cur) vis[x] = 1; l = md+1; ans = md; } else { r = md; for (auto i : cur) { move_outside(i); vis[x] = 0; } cur.clear(); } } return ans; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:40:12: error: 'vis' was not declared in this scope; did you mean 'vi'?
   40 |         if(vis[i]) continue;
      |            ^~~
      |            vi
insects.cpp:51:27: error: 'vis' was not declared in this scope; did you mean 'vi'?
   51 |         for(auto x : cur) vis[x] = 1;
      |                           ^~~
      |                           vi
insects.cpp:58:11: error: 'vis' was not declared in this scope; did you mean 'vi'?
   58 |           vis[x] = 0;
      |           ^~~
      |           vi
insects.cpp:58:15: error: 'x' was not declared in this scope
   58 |           vis[x] = 0;
      |               ^