| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1369796 | turkeyorz | Gift Boxes (EGOI25_giftboxes) | C++20 | 2094 ms | 6240 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
int t, n;
cin>>t>>n;
vector<int> a(n), cnt(t, 0);
for(auto &i : a) {
cin>>i;
++cnt[i];
}
pair<int, int> p = {-1, -1};
int tot = n - t;
for(int i=0;i<n;++i) {
int tot2 = 0;
vector<int> cnt2(t, 0);
for(int j=i;j<n;++j) {
if(cnt[a[j]] > 1) {
++tot2;
if(tot2 == tot) {
if(p.first == -1 || p.second - p.first + 1 > j - i + 1) {
p = {i, j};
}
}
}
--cnt[a[j]];
++cnt2[a[j]];
}
for(int i=0;i<t;++i)
cnt[i] += cnt2[i];
}
cout<<p.first<<' '<<p.second<<'\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--)
solve();
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... | ||||
