제출 #29117

#제출 시각아이디문제언어결과실행 시간메모리
29117aybala앵무새 (IOI11_parrots)C++11
컴파일 에러
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> #define fori(a,b,c) for(a=b; a<c; a++) #define ford(a,b,c) for(a=b; a>=c; a--) #define mp make_pair #define pb push_back #define ll long long #define pii pair<int,int> using namespace std; void encode(int N, int M[]) { if(N<=32){ int i; for(i=0; i<N; i++){ int x=2; int y=0; while(M[i]){ if(M[i]%x){ send(i*8+y); M[i]-=(x/2); } y++; x*=2; } } } else{ int i; for(i=0; i<N; i++){ int x=2; int y=0; while(M[i]){ if(M[i]%x){ if(y%2){ if(y==7){ send(i*5+4); } else{ send(i*5+(y-1)/2); send(i*5+(y-1)/2); } } else{ send((i*5)+(y/2)); } M[i]-=(x/2); } y++; x*=2; } } } }
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> #define fori(a,b,c) for(a=b; a<c; a++) #define ford(a,b,c) for(a=b; a>=c; a--) #define mp make_pair #define pb push_back #define ll long long #define pii pair<int,int> using namespace std; int us[8]={1,2,4,8,16,32,64,128}; void decode(int N, int L, int X[]) { if(N>32){ sort(X,X+L); int i,j,k; j=0; fori(i,0,N){ int cod=0; while(j<L && X[j]<=i*5+4){ int xj=X[j]; int r=0; while(j<L && xj==X[j]){ r++; j++; } xj-=i*5; if(r!=2){ cod+=us[xj*2]; } if(r!=1){ cod+=us[xj*2+1]; } if(xj==4){ cod+=us[7]; } } output(cod); } } else{ sort(X,X+L); int i,j,k; j=0; fori(i,0,N){ int cod=0; while(j<L && X[j]<=i*8+7){ X[j]-=i*8; cod+=us[X[j]]; j++; } output(cod); } } }#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> #define fori(a,b,c) for(a=b; a<c; a++) #define ford(a,b,c) for(a=b; a>=c; a--) #define mp make_pair #define pb push_back #define ll long long #define pii pair<int,int> using namespace std; int us[8]={1,2,4,8,16,32,64,128}; void decode(int N, int L, int X[]) { if(N>32){ sort(X,X+L); int i,j,k; j=0; fori(i,0,N){ int cod=0; while(j<L && X[j]<=i*5+4){ int xj=X[j]; int r=0; while(j<L && xj==X[j]){ r++; j++; } xj-=i*5; if(r!=2){ cod+=us[xj*2]; } if(r!=1){ cod+=us[xj*2+1]; } if(xj==4){ cod+=us[7]; } } output(cod); } } else{ sort(X,X+L); int i,j,k; j=0; fori(i,0,N){ int cod=0; while(j<L && X[j]<=i*8+7){ X[j]-=i*8; cod+=us[X[j]]; j++; } output(cod); } } }

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

decoder.cpp:60:2: error: stray '#' in program
 }#include "decoder.h"
  ^
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:18:11: warning: unused variable 'k' [-Wunused-variable]
   int i,j,k;
           ^
decoder.cpp:45:11: warning: unused variable 'k' [-Wunused-variable]
   int i,j,k;
           ^
decoder.cpp: At global scope:
decoder.cpp:60:3: error: 'include' does not name a type
 }#include "decoder.h"
   ^~~~~~~
decoder.cpp:71:9: error: redefinition of 'int us [8]'
 int us[8]={1,2,4,8,16,32,64,128};
         ^
decoder.cpp:12:5: note: 'int us [8]' previously defined here
 int us[8]={1,2,4,8,16,32,64,128};
     ^~
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:73:6: error: redefinition of 'void decode(int, int, int*)'
 void decode(int N, int L, int X[])
      ^~~~~~
decoder.cpp:14:6: note: 'void decode(int, int, int*)' previously defined here
 void decode(int N, int L, int X[])
      ^~~~~~
decoder.cpp:77:11: warning: unused variable 'k' [-Wunused-variable]
   int i,j,k;
           ^
decoder.cpp:104:11: warning: unused variable 'k' [-Wunused-variable]
   int i,j,k;
           ^