제출 #1123016

#제출 시각아이디문제언어결과실행 시간메모리
1123016RequiemOlympiads (BOI19_olympiads)C++20
44 / 100
347 ms107596 KiB
#include<bits/stdc++.h> #define int long long #define pb push_back #define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); #define MOD 1000000007 #define inf 1e18 #define fi first #define se second #define FOR(i,a,b) for(int i=a;i<=b;i++) #define FORD(i,a,b) for(int i=a;i>=b;i--) #define sz(a) ((int)(a).size()) #define endl '\n' #define pi 3.14159265359 #define TASKNAME "olympiad" using namespace std; template<typename T> bool maximize(T &res, const T &val) { if (res < val){ res = val; return true; }; return false; } template<typename T> bool minimize(T &res, const T &val) { if (res > val){ res = val; return true; }; return false; } typedef pair<int,int> ii; typedef pair<int,ii> iii; typedef vector<int> vi; const int MAXN = 5e5 + 9; int n, k, c; int a[MAXN][7]; namespace subtask1{ bool check(){ return n <= 500 and k <= 2 and c <= 2000; } vector<int> listVal; void solve(){ FOR(i, 1, n){ FOR(j, i + 1, n){ int p = 0; FOR(t, 1, k){ p += max(a[i][t], a[j][t]); } listVal.pb(p); } } sort(listVal.rbegin(), listVal.rend()); cout << listVal[c - 1] << ' '; } } namespace subtask2{ bool check(){ return n <= 40 or (n <= 500 and k <= 2); } int cnt[6000009]; vector<int> curTeam, listVal, sortedListVal; int getScore(){ int ans = 0; FOR(i, 1, k){ int cur = 0; FOR(j, 0, (int) curTeam.size() - 1){ maximize(cur, a[curTeam[j]][i]); } ans += cur; } return ans; } void backtrack(int pos){ if (curTeam.size() == k){ listVal.pb(getScore()); return; } if (pos == n + 1){ return; } backtrack(pos + 1); curTeam.pb(pos); backtrack(pos + 1); curTeam.pop_back(); } void solve(){ backtrack(1); sortedListVal.resize(listVal.size() + 9); FOR(i, 0, (int) listVal.size() - 1){ cnt[listVal[i]]++; } FORD(i, 6000000, 0){ cnt[i] += cnt[i + 1]; } FOR(i, 0, (int) listVal.size() - 1){ sortedListVal[--cnt[listVal[i]]] = listVal[i]; } cout << sortedListVal[c - 1] << endl; } } namespace subtask3{ bool check(){ return true; } int dp[5003][9]; void solve(){ dp[0][0] = 1; FOR(i, 1, 500){ } } } main() { fast; if (fopen(TASKNAME".inp","r")){ freopen(TASKNAME".inp","r",stdin); freopen(TASKNAME".out","w",stdout); } cin>> n>> k >> c; FOR(i, 1, n){ FOR(j, 1, k){ cin >> a[i][j]; } } // if (subtask1::check()) return subtask1::solve(), 0; if (subtask2::check()) return subtask2::solve(), 0; } /** Warning: Đọc sai đề??? Cận lmao Code imple thiếu case nào không. Limit. **/

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

olympiads.cpp:115:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  115 | main()
      | ^~~~
olympiads.cpp: In function 'int main()':
olympiads.cpp:119:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  119 |         freopen(TASKNAME".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
olympiads.cpp:120:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  120 |         freopen(TASKNAME".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...