제출 #444497

#제출 시각아이디문제언어결과실행 시간메모리
444497cheetose카멜레온의 사랑 (JOI20_chameleon)C++17
20 / 100
39 ms1348 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 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 = 998244353; 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 "chameleon.h" Vi v[1001]; bool chk[1001],e[1001][1001]; void Solve(int N){ fup(i,1,N,1){ int f=N+1; int l=f,r=2*N; while(l<=r){ Vi tmp={i}; int m=l+r>>1; fup(k,f,m,1)tmp.pb(k); if(Query(tmp)!=tmp.size())r=m-1; else l=m+1; } v[i].pb(l); v[l].pb(i); f=l+1; l=f,r=2*N; while(l<=r){ Vi tmp={i}; int m=l+r>>1; fup(k,f,m,1)tmp.pb(k); if(Query(tmp)!=tmp.size())r=m-1; else l=m+1; } if(l>2*N)continue; v[i].pb(l); v[l].pb(i); f=l+1; l=f,r=2*N; while(l<=r){ Vi tmp={i}; int m=l+r>>1; fup(k,f,m,1)tmp.pb(k); if(Query(tmp)!=tmp.size())r=m-1; else l=m+1; } if(l>2*N)continue; v[i].pb(l); v[l].pb(i); } fup(i,1,2*N,1){ if(v[i].size()==1){ if(chk[i] || chk[v[i][0]])continue; chk[i]=chk[v[i][0]]=1; Answer(i,v[i][0]); continue; } int a=v[i][0],b=v[i][1],c=v[i][2]; int t=Query({i,a,b}); if(t==1){ e[i][c]=1; continue; } t=Query({i,a,c}); if(t==1){ e[i][b]=1; continue; } t=Query({i,c,b}); if(t==1){ e[i][a]=1; continue; } } fup(i,1,2*N,1){ if(chk[i])continue; if(v[i].size()==3){ chk[i]=1; int a=v[i][0],b=v[i][1],c=v[i][2]; if(!e[i][a] && !e[a][i]){ chk[a]=1; Answer(i,a); continue; } if(!e[i][b] && !e[b][i]){ chk[b]=1; Answer(i,b); continue; } if(!e[i][c] && !e[c][i]){ chk[c]=1; Answer(i,c); continue; } } } } /* int main(){ }*/

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

chameleon.cpp: In function 'void Solve(int)':
chameleon.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))
      |                              ^
chameleon.cpp:47:2: note: in expansion of macro 'fup'
   47 |  fup(i,1,N,1){
      |  ^~~
chameleon.cpp:52:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   52 |    int m=l+r>>1;
      |          ~^~
chameleon.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))
      |                              ^
chameleon.cpp:53:4: note: in expansion of macro 'fup'
   53 |    fup(k,f,m,1)tmp.pb(k);
      |    ^~~
chameleon.cpp:54:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |    if(Query(tmp)!=tmp.size())r=m-1;
      |       ~~~~~~~~~~^~~~~~~~~~~~
chameleon.cpp:63:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   63 |    int m=l+r>>1;
      |          ~^~
chameleon.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))
      |                              ^
chameleon.cpp:64:4: note: in expansion of macro 'fup'
   64 |    fup(k,f,m,1)tmp.pb(k);
      |    ^~~
chameleon.cpp:65:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |    if(Query(tmp)!=tmp.size())r=m-1;
      |       ~~~~~~~~~~^~~~~~~~~~~~
chameleon.cpp:75:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   75 |    int m=l+r>>1;
      |          ~^~
chameleon.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))
      |                              ^
chameleon.cpp:76:4: note: in expansion of macro 'fup'
   76 |    fup(k,f,m,1)tmp.pb(k);
      |    ^~~
chameleon.cpp:77:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |    if(Query(tmp)!=tmp.size())r=m-1;
      |       ~~~~~~~~~~^~~~~~~~~~~~
chameleon.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))
      |                              ^
chameleon.cpp:84:2: note: in expansion of macro 'fup'
   84 |  fup(i,1,2*N,1){
      |  ^~~
chameleon.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))
      |                              ^
chameleon.cpp:108:2: note: in expansion of macro 'fup'
  108 |  fup(i,1,2*N,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...