Submission #112056

# Submission time Handle Problem Language Result Execution time Memory
112056 2019-05-17T08:07:56 Z AMO5 None (JOI16_memory2) C++
10 / 100
4 ms 512 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "Memory2_lib.h"

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define all(x) (x).begin(), (x).end() 

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

long long INF=numeric_limits<long long>::max();

int vis[1011],p[1011];
int adj[505][505];
vector<int> pos[55];

void query(int a, int b, int c)
{
	//cout << "q " << a << " " << b << " " << c << endl;
	if(adj[a][b]==adj[b][c]&&adj[a][b]==adj[a][c])
	{
	}
	else if(adj[a][b] == adj[a][c]&&!vis[a])
	{
		int val = adj[a][b];
		pos[val].pb(a);
		vis[a] = 1;
	}
	else if(adj[a][b] == adj[b][c]&&!vis[b])
	{
		int val = adj[a][b];
		pos[val].pb(b);
		vis[b] = 1;
	}
	else if(adj[a][c] == adj[b][c]&&!vis[c])
	{
		int val = adj[a][c];
		pos[val].pb(c);
		vis[c] = 1;
	}
	return;
}

void Solve(int T, int N){
	int n = N; N*=2;
	memset(vis,0,sizeof(vis));
	for(int i = 0; i < N; i++)
	{
		for(int j = i+1; j < N; j++)
		{
			if(i==j)continue;
			adj[i][j] = Flip(i,j);
			adj[j][i] = adj[i][j];
		}
	}
	
	for(int i = 0; i < N; i++)
	{
		if(vis[i])continue;
		for(int j = i+1; j < N; j++)
		{
			if(vis[j])continue;
			for(int k = j+1; k < N; k++)
			{
				if(vis[k])continue;
				query(i,j,k);
			}
		}
	}
	/*
	for(int i = 0; i < n; i++)
	{
		cout << i << " --- ";
		for(int j = 0; j < pos[i].size(); j++){
			cout << pos[i][j] << " " ;
		}
		cout << endl;
	}
	*/
	//visit smallest 
	int ptr = -1;
	for(int i = 0; i < n; i++)
	{
		if(pos[i].empty())
		{
			ptr = i;
			break;
		}
	}
	
	for(int i = 0; i < N; i++)
	{
		if(!vis[i])pos[ptr].pb(i);
	}
	
	for(int i = 0; i < n; i++)
	{
		Answer(pos[i][0],pos[i][1],i);
	}
	return;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 484 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 4 ms 512 KB Output is correct
4 Correct 1 ms 484 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -