#include "monster.h"
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define er erase
#define pb push_back
#define ppb pop_back()
#define ph push
#define pp pop()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
using namespace std;
std::vector<int> Solve(int N)
{
ll n = N;
if(n==4)
{
vector<ll> v1;
vector<ll> v2;
for(int i = 0 ; n>i ; i++)
{
ll x = 0;
for(int j = 0 ; n>j ; j++)
{
if(i==j)
continue;
if(Query(i,j))
x++;
}
if(x==1)
v1.pb(i);
else
v2.pb(i);
}
bool l = Query(v1[0],v2[0])|Query(v1[0],v2[1]);
vector<int> ans(n,0);
ans[v1[0]]=l;
ans[v1[1]]=1-l;
l = Query(v2[0],v1[0])&Query(v2[0],v1[1]);
ans[v2[0]]= 2+l;
ans[v2[1]]= 3-l;
return ans;
}
map<ll,ll> mp;
map<ll,ll> mp1;
map<ll,ll> mp2;
for(int i = 0 ; n>i ; i++)
{
ll x = 0;
vector<ll> v;
for(int j = 0 ; n>j ; j++)
{
if(j==i)
continue;
if(Query(i,j))
{
v.pb(j);
x++;
}
}
mp[i]=x;
if(x==2)
{
//cout << i << "\n";
for(auto it : v)
mp1[it]=1;
}
if(x==n-3)
{
for(auto it : v)
mp2[it]=1;
}
}
vector<int> ans(n,0);
/*for(auto it : mp1)
cout << it.F << " ";
lin*/
for(auto it : mp)
{
if(it.S==1)
{
if(mp1[it.F]==1)
ans[it.F]=0;
else
ans[it.F]=1;
continue;
}
if(it.S==n-2)
{
if(mp2[it.F]==1)
ans[it.F]=n-2;
else
ans[it.F]=n-1;
continue;
}
ans[it.F]=it.S;
}
/*for(auto it : ans)
cout << it << " ";
lin*/
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Incorrect |
121 ms |
600 KB |
Wrong Answer [6] |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Incorrect |
121 ms |
600 KB |
Wrong Answer [6] |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
100 ms |
856 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |