| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1369899 | turkeyorz | Gift Boxes (EGOI25_giftboxes) | C++20 | 27 ms | 10332 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve(int tc)
{
int t, n;
cin>>t>>n;
vector<int> a(n);
for(auto &i : a) {
cin>>i;
}
int tot = n - t, nn = 0;
pair<int, int> p = {-1, -1};
deque<int> p3;
deque<pair<int, int>> p2;
vector<int> cnt(t, 0);
for(int i=0;i<n;++i) {
++cnt[a[i]];
p2.push_back({a[i], cnt[a[i]]});
p3.push_back(i);
if(cnt[a[i]] == 1)
++nn;
while(p2.size() > 0 && p2[0].second == 1 && cnt[p2[0].first] == 2) {
--cnt[p2[0].first];
p2.pop_front();
p3.pop_front();
}
if(nn >= t) {
int gg = i - p3.front() + 1;
if(p.first == -1 || p.second - p.first + 1 > gg) {
p = {p3.front(), i};
}
}
}
cout<<p.first<<' '<<p.second<<'\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("problem.in", "r", stdin);
// freopen("problem.out", "w", stdout);
int t = 1;
// cin >> t;
for (int i = 1; i <= t; ++i) {
solve(t - i);
}
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... | ||||
