답안 #446390

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
446390 2021-07-21T20:28:05 Z cheetose 길고양이 (JOI20_stray) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a))
#define MEM_1(a) memset((a),-1,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define COMPRESS(a) sort(ALL(a));a.resize(unique(ALL(a))-a.begin())
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<ld> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 };


#include "Anthony.h"
Vi Mark(int N, int M, int A, int B, Vi U, Vi V){
	vector<Vi> v(N);
	fup(i,0,M-1,1){
		v[U[i]].pb(V[i]);
		v[V[i]].pb(U[i]);
	}
	Vi res(M),c(N);
	Vi d(N,-1);
	queue<int> q;
	q.push(0);
	d[0]=0;
	while(!q.empty()){
		int x=q.front();
		q.pop();
		for(int y:v[x]){
			if(d[y]==-1){
				d[y]=d[x]+1;
				q.push(y);
				if(A==2){
					if(x==0)c[x]=0;
					else if(v[x].size()>2)c[y]="010011"[c[x]]=='0'?1:0;
					else c[y]=(c[x]+1)%6;
				}
			}
		}
	}
	if(A==2){
		fup(i,0,M-1,1){
			int t=d[U[i]]<d[T[i]]?U[i]:T[i];
			res[i]="010011"[c[t]]-'0';
		}
	}else{
		fup(i,0,M-1,1){
			int t=min(d[U[i]],d[V[i]]);
			res[i]=t%3;
		}
	}
	
	return res;
}
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a))
#define MEM_1(a) memset((a),-1,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define COMPRESS(a) sort(ALL(a));a.resize(unique(ALL(a))-a.begin())
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<ld> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 };

#include "Catherine.h"


int a,b;
int pr=-1;
bool ok;
strint s;
void Init(int A,int B){
	a=A,b=B;
}

int Move(Vi y){
	if(a==2){
		Vi yy=y;
		if(pr!=-1)yy[pr]++;
		int deg=yy[0]+yy[1];
		if(deg!=2){
			ok=1;
			int r;
			if(yy[0]==1)r=0;
			else r=1;
			if(r==pr)r=-1;
			return r;
		}
		if(ok){
			if(y[0]==1)return 0;
			return 1;
		}
		fup(i,0,1,1){
			fup(k,0,y[i]-1,1)s+=(char)(i+'0');
		}
		if(s.length()==5){
			fup(i,0,5,1){
				if(s==string("010011010011").substr(i,5)){
					ok=1;
					return (int)(s[4]-'0');
				}
			}
			ok=1;
			return -1;
		}
		int r=(int)(s.back()-'0');
		pr=r;
		return r;
	}else{
		if(y[0]==0 && y[1]==0)return 2;
		if(y[0]==0 && y[2]==0)return 1;
		if(y[1]==0 && y[2]==0)return 0;
		fup(j,0,2,1)if(y[j]==0)return (j+1)%3;
		return -1;
	}
}

Compilation message

Anthony.cpp: In function 'Vi Mark(int, int, int, int, Vi, Vi)':
Anthony.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
Anthony.cpp:47:2: note: in expansion of macro 'fup'
   47 |  fup(i,0,M-1,1){
      |  ^~~
Anthony.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
Anthony.cpp:72:3: note: in expansion of macro 'fup'
   72 |   fup(i,0,M-1,1){
      |   ^~~
Anthony.cpp:73:20: error: 'T' was not declared in this scope
   73 |    int t=d[U[i]]<d[T[i]]?U[i]:T[i];
      |                    ^
Anthony.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
Anthony.cpp:77:3: note: in expansion of macro 'fup'
   77 |   fup(i,0,M-1,1){
      |   ^~~

Catherine.cpp:49:1: error: 'strint' does not name a type; did you mean 'stdin'?
   49 | strint s;
      | ^~~~~~
      | stdin
Catherine.cpp: In function 'int Move(Vi)':
Catherine.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
Catherine.cpp:71:3: note: in expansion of macro 'fup'
   71 |   fup(i,0,1,1){
      |   ^~~
Catherine.cpp:10:30: warning: unnecessary parentheses in declaration of 'k' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
Catherine.cpp:72:4: note: in expansion of macro 'fup'
   72 |    fup(k,0,y[i]-1,1)s+=(char)(i+'0');
      |    ^~~
Catherine.cpp:72:21: error: 's' was not declared in this scope
   72 |    fup(k,0,y[i]-1,1)s+=(char)(i+'0');
      |                     ^
Catherine.cpp:74:6: error: 's' was not declared in this scope
   74 |   if(s.length()==5){
      |      ^
Catherine.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
Catherine.cpp:75:4: note: in expansion of macro 'fup'
   75 |    fup(i,0,5,1){
      |    ^~~
Catherine.cpp:84:15: error: 's' was not declared in this scope
   84 |   int r=(int)(s.back()-'0');
      |               ^
Catherine.cpp:10:30: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
Catherine.cpp:91:3: note: in expansion of macro 'fup'
   91 |   fup(j,0,2,1)if(y[j]==0)return (j+1)%3;
      |   ^~~