# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1070066 | 2024-08-22T11:27:30 Z | Unforgettablepl | Rarest Insects (IOI22_insects) | C++17 | 74 ms | 596 KB |
#include "insects.h" #include <bits/stdc++.h> using namespace std; int min_cardinality(int N){ vector<int> uniques = {0}; move_inside(0); vector<bool> isCommon(N); vector<int> ans(N,-1); ans[0]=1; for(int i=1;i<N;i++) { move_inside(i); if(press_button()==1) { uniques.emplace_back(i); ans[i]=1; } else { move_outside(i); isCommon[i]=true; } } for(int&i:uniques)move_outside(i); for(int jump=1024;jump;jump/=2) { vector<pair<int,int>> queries; for(int i=0;i<N;i++)if(isCommon[i]) { if(ans[i]+jump>=uniques.size()-1)continue; queries.emplace_back(ans[i]+jump,i); } int added = -1; sort(queries.begin(),queries.end()); for(auto&[x,idx]:queries) { while(added<x)move_inside(uniques[++added]); while(added>x)move_outside(uniques[added--]); move_inside(idx); if(press_button()==1)ans[idx]=x; move_outside(idx); } } for(int i=0;i<N;i++)if(isCommon[i])ans[uniques[ans[i]+1]]++; int siz = N; for(int i=0;i<N;i++)if(!isCommon[i])siz=min(siz,ans[i]); return siz; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Incorrect | 3 ms | 596 KB | Wrong answer. |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Incorrect | 3 ms | 596 KB | Wrong answer. |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 12 ms | 344 KB | Output is correct |
8 | Correct | 13 ms | 460 KB | Output is correct |
9 | Incorrect | 74 ms | 444 KB | Wrong answer. |
10 | Halted | 0 ms | 0 KB | - |