이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define FOR(i, j, n) for(int j = i; j < n; ++j)
#define forn(i, j, n) for(int j = i; j <= n; ++j)
#define nfor(i, j, n) for(int j = n; j >= i; --j)
#define all(v) v.begin(), v.end()
#define ld long double
#define ull unsigned long long
using namespace std;
const int maxn=1e6+10,LOG=17,mod=998244353;
int block = 226, timer = 0;
const ld EPS = 1e-18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define bt(i) (1 << (i))
//#define int ll
const int inf=2e9;
#define y1 yy
#define prev pre
#define pii pair <int, int>
ll mni[maxn], mxi[maxn];
ll mx[maxn], mn[maxn];
bool cmp(pii a, pii b)
{
return a.f > b.f;
}
long long find_maximum(int k, vector <vector <int> > a)
{
vector <vector <int> > use, mark;
int n = a.size();
int m = a[0].size();
use = a;
forn(0, i, n-1) forn(0, j, m-1) use[i][j] = -1;
ll ret = 0;
forn(0, iter, k-1)
{
vector <pii> vec;
forn(0, i, n-1)
{
mx[i] = -inf;
mn[i] = inf;
forn(0, j, m-1)
{
if(use[i][j] != -1) continue;
if(mx[i] < a[i][j])
{
mx[i] = a[i][j];
mxi[i] = j;
}
if(mn[i] > a[i][j])
{
mn[i] = a[i][j];
mni[i] = j;
}
}
vec.pb({mx[i]+mn[i], i});
}
sort(all(vec), cmp);
FOR(0, i, n / 2)
{
use[vec[i].s][mxi[vec[i].s]] = iter;
ret += mx[vec[i].s];
}
FOR(n / 2, i, n)
{
use[vec[i].s][mni[vec[i].s]] = iter;
ret -= mn[vec[i].s];
}
}
allocate_tickets(use);
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |