제출 #231064

#제출 시각아이디문제언어결과실행 시간메모리
231064Coroian_David앵무새 (IOI11_parrots)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" void aduna(int a[], int b[]) { cout << " ADUN " << a[0] << " " << b[0] << "\n"; cout << a[1] << " " << b[1] << " " << a[2] << " " << b[2] << "\n"; int i = 1; int t = 0; for(i = 1; i <= max(a[0], b[0]) || t; i ++) { // cout << " SUTNEM " << i << "\n"; a[i] += b[i] + t; t = 0; if(a[i] > 9) { t = a[i] / 10; a[i] %= 10; } } cout << a[0] << " " << i-1 << "\n"; a[0] = i - 1; } bool cmp(int a[], int b[]) { if(a[0] > b[0]) return 1; if(a[0] < b[0]) return 0; for(int i = a[0]; i >= 1; i --) { if(a[i] != b[i]) return (a[i] > b[i]); } return 1; } struct nr { int v[200]; /* nr operator + (nr &x) { aduna(v, x.v); return *v; }*/ void operator +=(nr &x) { aduna (v, x.v); } bool operator > (nr &x) { return cmp(v, x.v); } /* operator [] (nr & x) { return *x; }*/ /* nr operator = (nr &x) { //*v** = *(x.v); return x; }*/ }; nr a, b; void encode(int N, int M[]) { int k = 0; int a[700]; for(int i = 0; i < N; i ++) { for(int j = 7; j >= 0; j --) a[++ k] = (((1 << j) & M[i]) != 0); } int cr = 0; for(int i = 1; i <= k; i += 2) { int nr = (a[i] << 1) + a[i + 1]; for(int j = 1; j <= nr; j ++) send(cr); cr ++; } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> void decode(int N, int L, int X[]) { int ap[600]; for(int i = 0; i <= 255; i ++) ap[i] = 0; for(int i = 0; i < L; i ++) ap[X[i]] ++; int cr = 0; for(int i = 0; i < N; i ++) { int nr = (ap[cr] << 6) + (ap[cr + 1] << 4) + (ap[cr + 2] << 2) + ap[cr + 3]; output(nr); cr += 4; } }

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

encoder.cpp:78:10: warning: "/*" within comment [-Wcomment]
         //*v** = *(x.v);
           
encoder.cpp: In function 'void aduna(int*, int*)':
encoder.cpp:8:5: error: 'cout' was not declared in this scope
     cout << " ADUN " << a[0] << " " << b[0] << "\n";
     ^~~~
encoder.cpp:8:5: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:75:0,
                 from encoder.cpp:1:
/usr/include/c++/7/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~
encoder.cpp:13:21: error: 'max' was not declared in this scope
     for(i = 1; i <= max(a[0], b[0]) || t; i ++)
                     ^~~
encoder.cpp:13:21: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from encoder.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~