Submission #921083

#TimeUsernameProblemLanguageResultExecution timeMemory
921083shoryu386Olympiads (BOI19_olympiads)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int scores[507][6]; int n, k, c; vector<pair<vector<int>, int>> res1[6]; vector<pair<vector<int>, int>> res2[6]; map<vector<int>, int> store[507][6]; int stop; void recur(int x, int remain, vector<int> cur, int cnt){ //cout << x << ' ' << remain << ' ' << cnt << '\n'; //for (auto y : cur) cout << y << ' '; //cout << "\n\n"; if (x == stop){ res1[remain].push_back({cur, cnt}); return; } store[x+1][remain][cur] += cnt; if (remain != 0){ for (int y = 0; y < k; y++){ cur[y] = max(cur[y], scores[x][y]); } store[x+1][remain-1][cur] += cnt; } } void recur2(int x, int remain, vector<int> cur, int cnt){ //cout << x << ' ' << remain << ' ' << cnt << '\n'; //for (auto y : cur) cout << y << ' '; //cout << "\n\n"; if (x == n){ res2[remain].push_back({cur, cnt}); return; } store[x+1][remain][cur] += cnt; if (remain != 0){ for (int y = 0; y < k; y++){ cur[y] = max(cur[y], scores[x][y]); } store[x+1][remain-1][cur] += cnt; } } main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> k >> c; stop = n/2; for (int x = 0; x < n; x++){ for (int y = 0; y < k; y++){ cin >> scores[x][y]; } } vector<int> init; for (int x = 0; x < k; x++){ init.push_back(LLONG_MIN/20); } store[0][k][init] = 1; for (int x = 0; x <= stop; x++){ for (int y = 0; y <= k; y++){ while (!store[x][y].empty()){ auto vals = *store[x][y].begin(); recur(x, y, vals.first, vals.second); store[x][y].erase(store[x][y].begin()); } } } store[stop][k][init] = 1; for (int x = stop; x <= n; x++){ for (int y = 0; y <= k; y++){ while (!store[x][y].empty()){ auto vals = *store[x][y].begin(); recur2(x, y, vals.first, vals.second); store[x][y].erase(store[x][y].begin()); } } }#include <bits/stdc++.h> using namespace std; #define int long long int scores[507][6]; int n, k, c; vector<pair<vector<int>, int>> res1[6]; vector<pair<vector<int>, int>> res2[6]; map<vector<int>, int> store[507][6]; int stop; void recur(int x, int remain, vector<int> cur, int cnt){ //cout << x << ' ' << remain << ' ' << cnt << '\n'; //for (auto y : cur) cout << y << ' '; //cout << "\n\n"; if (x == stop){ res1[remain].push_back({cur, cnt}); return; } store[x+1][remain][cur] += cnt; if (remain != 0){ for (int y = 0; y < k; y++){ cur[y] = max(cur[y], scores[x][y]); } store[x+1][remain-1][cur] += cnt; } } void recur2(int x, int remain, vector<int> cur, int cnt){ //cout << x << ' ' << remain << ' ' << cnt << '\n'; //for (auto y : cur) cout << y << ' '; //cout << "\n\n"; if (x == n){ res2[remain].push_back({cur, cnt}); return; } store[x+1][remain][cur] += cnt; if (remain != 0){ for (int y = 0; y < k; y++){ cur[y] = max(cur[y], scores[x][y]); } store[x+1][remain-1][cur] += cnt; } } main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> k >> c; stop = n/2; for (int x = 0; x < n; x++){ for (int y = 0; y < k; y++){ cin >> scores[x][y]; } } vector<int> init; for (int x = 0; x < k; x++){ init.push_back(LLONG_MIN/20); } store[0][k][init] = 1; for (int x = 0; x <= stop; x++){ for (int y = 0; y <= k; y++){ while (!store[x][y].empty()){ auto vals = *store[x][y].begin(); recur(x, y, vals.first, vals.second); store[x][y].erase(store[x][y].begin()); } } } store[stop][k][init] = 1; for (int x = stop; x <= n; x++){ for (int y = 0; y <= k; y++){ while (!store[x][y].empty()){ auto vals = *store[x][y].begin(); recur2(x, y, vals.first, vals.second); store[x][y].erase(store[x][y].begin()); } } } vector<pair<int, int>> ans; for (int x = 0; x <= k; x++){ for (auto r1 : res1[x]){ for (auto r2 : res2[k-x]){ int kek = 0; for (int z = 0; z < k; z++){ kek += max(r1.first[z], r2.first[z]); } ans.push_back({kek, r1.second * r2.second}); } } } int sum = 0; for (int x = 0; x < ans.size(); x++){ sum += ans[x].second; if (sum >= c){ cout << ans[x].first; break; } } } vector<pair<int, int>> ans; for (int x = 0; x <= k; x++){ for (auto r1 : res1[x]){ for (auto r2 : res2[k-x]){ int kek = 0; for (int z = 0; z < k; z++){ kek += max(r1.first[z], r2.first[z]); } ans.push_back({kek, r1.second * r2.second}); } } } sort(ans.begin(), ans.end(), greater<pair<int, int>()); //for (auto y : ans) cout << y.first << ' ' << y.second << '\n'; int sum = 0; for (int x = 0; x < ans.size(); x++){ sum += ans[x].second; if (sum >= c){ cout << ans[x].first; break; } } }

Compilation message (stderr)

olympiads.cpp:96:3: error: stray '#' in program
   96 |  }#include <bits/stdc++.h>
      |   ^
olympiads.cpp:54:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   54 | main(){
      | ^~~~
olympiads.cpp: In function 'int main()':
olympiads.cpp:96:4: error: 'include' was not declared in this scope
   96 |  }#include <bits/stdc++.h>
      |    ^~~~~~~
olympiads.cpp:96:13: error: 'bits' was not declared in this scope
   96 |  }#include <bits/stdc++.h>
      |             ^~~~
olympiads.cpp:96:18: error: 'stdc' was not declared in this scope; did you mean 'std'?
   96 |  }#include <bits/stdc++.h>
      |                  ^~~~
      |                  std
olympiads.cpp:97:1: error: expected primary-expression before 'using'
   97 | using namespace std;
      | ^~~~~
olympiads.cpp:111:56: error: a function-definition is not allowed here before '{' token
  111 | void recur(int x, int remain, vector<int> cur, int cnt){
      |                                                        ^
olympiads.cpp:130:57: error: a function-definition is not allowed here before '{' token
  130 | void recur2(int x, int remain, vector<int> cur, int cnt){
      |                                                         ^
olympiads.cpp:149:7: error: expected ';' before '{' token
  149 | main(){
      |       ^
      |       ;
olympiads.cpp:236:54: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp> struct std::greater'
  236 |  sort(ans.begin(), ans.end(), greater<pair<int, int>());
      |                                                      ^
olympiads.cpp:236:54: note:   expected a type, got 'std::pair<long long int, long long int>()'
olympiads.cpp:240:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  240 |  for (int x = 0; x < ans.size(); x++){
      |                  ~~^~~~~~~~~~~~
olympiads.cpp:102:5: warning: unused variable 'scores' [-Wunused-variable]
  102 | int scores[507][6];
      |     ^~~~~~
olympiads.cpp:103:5: warning: unused variable 'n' [-Wunused-variable]
  103 | int n, k, c;
      |     ^
olympiads.cpp:109:5: warning: unused variable 'stop' [-Wunused-variable]
  109 | int stop;
      |     ^~~~