Submission #1005489

#TimeUsernameProblemLanguageResultExecution timeMemory
1005489khanhtbRarest Insects (IOI22_insects)C++17
10 / 100
235 ms344 KiB
#include<bits/stdc++.h> #include "insects.h" #define ll int #define ull unsigned long long #define ld double #define pb push_back #define pf push_front #define vi vector<ll> #define vii vector<vi> #define pll pair<ll,ll> #define vpll vector<pll> #define all(a) a.begin(), a.end() #define fi first #define se second using namespace std; const ll mod = 1e9+7; const ll inf = 1e18; const ll base = 31; const ll blocksz = 320; const ll N = 1e5+8; int col[N]; int c[N]; int min_cardinality(int n){ int now_col = 1; for(int i = 0; i < n; i++){ if(!col[i]){ vi clear_col; clear_col.pb(i); move_inside(i), col[i] = now_col; int cnt = 1; for(int j = i+1; j < n; j++){ if(!col[j]){ move_inside(j); int rep = press_button(); if(rep > cnt) col[j] = now_col, cnt++, clear_col.pb(j); else move_outside(j); } } for(int x:clear_col) move_outside(x); now_col++; } } for(int i = 0; i < n; i++) c[col[i]]++; int ans = N; for(int i = 0; i < n; i++){ if(c[col[i]] > 0) ans = min(ans,c[col[i]]); } return ans; }

Compilation message (stderr)

insects.cpp:17:16: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   17 | const ll inf = 1e18;
      |                ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...