| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363588 | biserailieva | Guessing Game (EGOI23_guessinggame) | C++20 | 362 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;
int cur=1;
for(int i=0;i<N-1;i++)
{
int idx;
cin>>idx;
if(i<(N+1)/2)
{
cout<<cur<<endl;
}
else
{
cout<<cur-(N+1)/2<<endl;
}
cur++;
}
}
else
{
vector<int>A(N);
map<int, int>freq;
int i1=-1, i2=-1;
for(int i=0;i<N;i++)
{
cin>>A[i];
}
for(int i=0;i<(N+1)/2;i++)
{
freq[A[i]]++;
if(freq[A[i]]==2)
{
i1=i;
for(int j=0;j<(N+1)/2;j++)
{
if(A[j]==A[i])
{
i2=j;
cout<<i2<<' '<<i1<<endl;
return 0;
}
}
}
}
map<int, int>freq2;
for(int i=(N+1)/2;i<N-1;i++)
{
freq2[A[i]]++;
if(freq2[A[i]]==2)
{
i1=i;
for(int j=(N+1)/2;j<N-1;j++)
{
if(A[j]==A[i])
{
i2=j;
cout<<i2<<' '<<i1<<endl;
return 0;
}
}
}
}
}
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
