답안 #112055

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112055 2019-05-17T08:07:23 Z AMO5 Memory 2 (JOI16_memory2) C++
컴파일 오류
0 ms 0 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;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int t,n,q;
	cin >> t >> n >> q;
	Solve(t,n);
}

Compilation message

/tmp/ccKroT9r.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccepXj97.o:memory2.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status