제출 #309110

#제출 시각아이디문제언어결과실행 시간메모리
309110cheetoseHandcrafted Gift (IOI20_gift)C++17
100 / 100
203 ms16176 KiB
#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 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<db> 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 "gift.h" int parent[500000]; int find(int a) { if (parent[a] < 0)return a; return parent[a] = find(parent[a]); } void merge(int a, int b) { a = find(a), b = find(b); if (a != b) { parent[a] = b; } } int construct(int n, int r, Vi a, Vi b, Vi x){ MEM_1(parent); fup(i,0,r-1,1){ if(x[i]==2)continue; int x=find(a[i]),y=find(b[i]); while(x!=y){ merge(x,x+1); x=find(x); } } fup(i,0,r-1,1){ if(x[i]==2){ if(find(a[i])==find(b[i]))return 0; } } string s; int t=0; fup(i,0,n-1,1){ s+=t?'B':'R'; if(parent[i]<0)t^=1; } craft(s); return 1; } /* int main() { }*/

컴파일 시 표준 에러 (stderr) 메시지

gift.cpp: In function 'int construct(int, int, Vi, Vi, Vi)':
gift.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))
      |                              ^
gift.cpp:59:2: note: in expansion of macro 'fup'
   59 |  fup(i,0,r-1,1){
      |  ^~~
gift.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))
      |                              ^
gift.cpp:67:2: note: in expansion of macro 'fup'
   67 |  fup(i,0,r-1,1){
      |  ^~~
gift.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))
      |                              ^
gift.cpp:74:2: note: in expansion of macro 'fup'
   74 |  fup(i,0,n-1,1){
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...