제출 #530639

#제출 시각아이디문제언어결과실행 시간메모리
530639byunjaewooBroken Device (JOI17_broken_device)C++17
0 / 100
52 ms2704 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; bool chk[155]; void MySet(int p, int a, int b, int c) { Set(p, a); Set(p+1, b); Set(p+2, c); } void Anna( int N, long long X, int K, int P[] ){ fill(chk, chk+151, 0); for(int i=0; i<K; i++) chk[P[i]]=1; vector<bool> V; while(X) { V.push_back(X%2); X/=2; } for(int i=0, p=0; i<150; i+=3) { if(p>=V.size()) { MySet(i, 0, 0, 0); continue; } if(chk[i]+chk[i+1]+chk[i+2]==0) { if(p==V.size()-1) V.push_back(0); if(V[p]==0 && V[p+1]==0) MySet(i, 1, 0, 0); else if(V[p]==0 && V[p+1]==1) MySet(i, 1, 0, 1); else if(V[p]==1 && V[p+1]==0) MySet(i, 0, 1, 1); else MySet(i, 1, 1, 1); } else if(chk[i]+chk[i+1]+chk[i+2]==1) { if(chk[i]) { if(V[p]==0) MySet(i, 0, 1, 0); else MySet(i, 0, 0, 1); p++; } else if(chk[i+1]) { if(V[p]==0) { if(p==V.size()-1) V.push_back(0); if(V[p+1]==0) MySet(i, 1, 0, 0); else MySet(i, 1, 0, 1); p+=2; } else {MySet(i, 0, 0, 1); p++;} } else { if(V[p]==0) MySet(i, 0, 1, 0); else MySet(i, 1, 1, 0); } } else MySet(i, 0, 0, 0); } }
#include <bits/stdc++.h> using namespace std; #include "Brunolib.h" long long Bruno( int N, int A[] ){ long long x=0; for(int i=N-1; i>=0; i-=3) { int tmp=A[i-2]*4+A[i-1]*2+A[i]; if(tmp==1) x=x*2+1; if(tmp==2) x*=2; if(tmp==3) x=x*4+1; if(tmp==4) x*=4; if(tmp==5) x=x*4+2; if(tmp==6) x=x*2+1; if(tmp==7) x=x*4+3; } return x; }

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

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:20:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         if(p>=V.size()) {
      |            ~^~~~~~~~~~
Anna.cpp:25:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             if(p==V.size()-1) V.push_back(0);
      |                ~^~~~~~~~~~~~
Anna.cpp:39:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |                     if(p==V.size()-1) V.push_back(0);
      |                        ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...