제출 #549568

#제출 시각아이디문제언어결과실행 시간메모리
549568PunnyBunny앵무새 (IOI11_parrots)C++17
컴파일 에러
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() int nxt() { int t; cin >> t; return t; } int dp[17][20]; vector<int> encode(int x) { vector<int> res(20); for (int j = 19; j >= 0; --j) { for (int i = 0; i < 17; ++i) { if (x - dp[i][j] < 0) { res[j] = i; break; } x -= dp[i][j]; } } while (res.back() == 16) res.pop_back(); return res; } void encode(int n, int vc[]) { for (int i = 0; i < 17; ++i) dp[i][0] = 1; for (int j = 1; j < 20; ++j) { for (int i = 0; i < 17; ++i) { for (int k = 0; k <= i; ++k) { dp[i][j] += dp[k][j - 1]; } } } vector<int> v(vc, vc+n); while (n % 4) { v.push_back(0); ++n; } vector<int> ans; for (int i = 0; i < n; i += 4) { auto x = encode((v[i] << 24) + (v[i + 1] << 16) + (v[i + 2] << 8) + v[i + 3]); for (int j : x) ans.push_back(((i / 4) << 4) + j); } for (int i : ans) send(i); }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; int decode(vector<int> x) { sort(all(x)); while (x.size() < 20) x.push_back(16); int res = 0; for (int j = 0; j < 20; ++j) { for (int i = 1; i < 17; ++i) { if (x[j] >= i) res += dp[i - 1][j]; } } return res; } void decode(int n, int m, int vc[]) { for (int i = 0; i < 17; ++i) dp[i][0] = 1; for (int j = 1; j < 20; ++j) { for (int i = 0; i < 17; ++i) { for (int k = 0; k <= i; ++k) { dp[i][j] += dp[k][j - 1]; } } } vector<int> u[16]; for (int i : vc) { int idx = i >> 4; u[idx].push_back(i & 15); } vector<int> ans; for (auto x : u) { // n! if (x.empty()) continue; int y = decode(x); ans.push_back(y >> 24); ans.push_back(y >> 16 & 255); ans.push_back(y >> 8 & 255); ans.push_back(y & 255); } for (int i = 0; i < n; ++i) output(ans[i]); }

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

/usr/bin/ld: /tmp/ccppumoU.o: in function `main':
grader_encoder.cpp:(.text.startup+0x162): undefined reference to `encode(int, int*)'
collect2: error: ld returned 1 exit status

decoder.cpp: In function 'int decode(std::vector<int>)':
decoder.cpp:6:10: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
    6 |     sort(all(x));
      |          ^~~
      |          std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from decoder.cpp:3:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
decoder.cpp:12:35: error: 'dp' was not declared in this scope
   12 |             if (x[j] >= i) res += dp[i - 1][j];
      |                                   ^~
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:18:32: error: 'dp' was not declared in this scope
   18 |   for (int i = 0; i < 17; ++i) dp[i][0] = 1;
      |                                ^~
decoder.cpp:22:17: error: 'dp' was not declared in this scope
   22 |                 dp[i][j] += dp[k][j - 1];
      |                 ^~
decoder.cpp:28:26: error: 'begin' was not declared in this scope
   28 |             for (int i : vc) {
      |                          ^~
decoder.cpp:28:26: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from decoder.cpp:3:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from decoder.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
decoder.cpp:28:26: error: 'end' was not declared in this scope
   28 |             for (int i : vc) {
      |                          ^~
decoder.cpp:28:26: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from decoder.cpp:3:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from decoder.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~