제출 #38199

#제출 시각아이디문제언어결과실행 시간메모리
38199smu201111192앵무새 (IOI11_parrots)C++14
81 / 100
51 ms2520 KiB
#include <vector> #include <iostream> #include "encoder.h" #include "encoderlib.h" /* #include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> #include <vector> #include <iostream> #include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> */ using namespace std; const int MAXN = 257; int cnt[MAXN][4]; void encode(int N, int M[]){ vector<int> res; for(int i=0;i<256;i++){ int flag = 1; for(int j=0;j<=5;j++){ for(int k=0;k<=5;k++){ for(int d=0;d<=5;d++){ for(int c=0;c<=5;c++){ if(j+4*k+16*d+64*c==i){ cnt[i][0] = j; cnt[i][1] = k; cnt[i][2] = d; cnt[i][3] = c; } } } } } } vector<int> packet; for(int i=0;i<N;i++){ int bit = i<<3; int mx1 = max(cnt[M[i]][0],cnt[M[i]][1]); //1 4 int mx2 = max(cnt[M[i]][2],cnt[M[i]][3]); //16 64 int t1 = cnt[M[i]][0]; int t2 = cnt[M[i]][1]; int flag = 0; for(int j=1;j<=mx1;j++){ int add = bit + flag; if(t1>0)add |= 1; //1 if(t2>0)add |= 2; //4 t1--; t2--; packet.push_back(add); } t1 = cnt[M[i]][2]; t2 = cnt[M[i]][3]; for(int j=1;j<=mx2;j++){ int add = bit + 4; if(t1>0) add |= 1; if(t2>0) add |= 2; t1--; t2--; packet.push_back(add); } if(mx1 == 0 && mx2 == 0){ packet.push_back(bit); } } for(int num:packet) send(num); }
#include <vector> #include <iostream> #include "decoder.h" #include "decoderlib.h" using namespace std; void decode(int N, int L, int X[]){ vector<int> res(N,0); if(N<=32){ for(int i=0;i<L;i++){ int loc = X[i]/8; int flag = X[i] & 4; int num = 0; if(!flag){ if(X[i] & 1) num += 1; if(X[i] & 2) num += 4; //1 4 () } else{ if(X[i] & 1) num += 16; if(X[i] & 2) num += 64; // 16 64 } res[loc] += num; } } else{ } for(int num:res) output(num); }

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

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:32:13: warning: unused variable 'flag' [-Wunused-variable]
         int flag = 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...