| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363601 | biserailieva | Guessing Game (EGOI23_guessinggame) | C++20 | 364 ms | 856 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int P, N;
cin>>P>>N;
if(P==1)
{
cout<<(N+1)/2<<endl;
for(int i=0;i<N-1;i++)
{
int idx;
cin>>idx;
if(i<(N+1)/2)
{
cout<<i+1<<endl;
}
else
{
cout<<i-(N+1)/2+1<<endl;
}
}
}
else
{
vector<int>A(N);
unordered_map<int, int>freq, freq2;
int i1=-1, i2=-1;
for(int i=0;i<N;i++)
{
cin>>A[i];
}
for(int i=0;i<N;i++)
{
if (i < (N + 1) / 2)
{
if (freq.count(A[i]))
{
i1 = freq[A[i]];
i2 = i;
break;
}
freq[A[i]] = i;
}
else
{
if (freq2.count(A[i]))
{
i1 = freq2[A[i]];
i2 = i;
break;
}
freq2[A[i]] = i;
}
}
if (i1 == -1)
{
cout << 0 << " " << 0 << endl;
}
else
{
cout << i1 << " " << i2 << endl;
}
}
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
