이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |