| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357151 | sally | Gift Boxes (EGOI25_giftboxes) | C++20 | 2094 ms | 4280 KiB |
#include<iostream>
#include<vector>
#include<set>
#include<cstring>
using namespace std;
const int mx = 5e5+5;
vector<int> team(mx);
int T, N;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin>>T>>N;
for(int i=0; i<N; i++) {
cin>>team[i];
}
// set<int> ill;
for(int len = 1; len<=N; len++) {
int ill_cnt = 0;
vector<int> cnt(mx, 0);
vector<bool> ill(mx, 0);
for(int j = len; j<N; j++) {
cnt[team[j]]++;
if(cnt[team[j]]>1) {
if(!ill[team[j]]) ill_cnt++;
ill[team[j]] = 1;
}
}
if(ill_cnt<=0) {cout<<0<<' '<<len-1; return 0;}
for(int L = 1; L + len - 1 <N; L++) {
int R = L + len - 1;
cnt[team[L-1]]++;
if(cnt[team[L-1]]>1) {
if(!ill[team[L-1]]) ill_cnt++;
ill[team[L-1]] = 1;
}
cnt[team[R]]--;
if(cnt[team[R]]<=1) {
if(ill[team[R]]) ill_cnt--;
ill[team[R]] = 0;
}
if(ill_cnt<=0) {
cout<<L<<' '<<R;
return 0;
}
}
}
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
