Submission #525501

#TimeUsernameProblemLanguageResultExecution timeMemory
525501Yazan_AlattarOlympiads (BOI19_olympiads)C++14
0 / 100
2083 ms17904 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second #define pb push_back //#define endl "\n" #define all(x) x.begin(), x.end() const int M = 507; const ll inf = 1e9; const ll mod = 998244353; const double pi = acos(-1); const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}; bool cmp(int a, int b) { return (a > b); } int n, k, c, a[M][M]; bool valid (vector <int> v, int person) { for(auto i : v) if(person == i) return 0; return 1; } int val (vector <int> v) { int ret = 0; for(int i = 1; i <= (int)v.size(); ++i){ int mx = 0; for(auto j : v) mx = max(mx, a[-j][i]); ret += mx; } return ret; } int main() { scanf("%d%d%d", &n, &k, &c); for(int i = 1; i <= n; ++i) for(int j = 1; j <= k; ++j) scanf("%d", &a[i][j]); vector < pair < int, vector <int> > > v; v.pb({0, {}}); for(int turn = 1; turn <= k; ++turn){ vector < pair < int, vector <int> > > to; for(auto i : v){ for(int j = 1; j <= n; ++j) if(valid(i.S, -j)) { vector <int> tmp = i.S; tmp.pb(-j); sort(all(tmp), cmp); to.pb({-val(tmp), tmp}); } } v.clear(); for(auto i : to){ bool add = 1; for(auto j : v) if(i.S == j.S){ add = 0; break; } if(add) v.pb(i); } sort(all(v)); while((int)v.size() > c + 200) v.pop_back(); } printf("%d\n", -v.back().F); return 0; }

Compilation message (stderr)

olympiads.cpp: In function 'int main()':
olympiads.cpp:36:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |  scanf("%d%d%d", &n, &k, &c);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
olympiads.cpp:37:63: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |  for(int i = 1; i <= n; ++i) for(int j = 1; j <= k; ++j) scanf("%d", &a[i][j]);
      |                                                          ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...