이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#ifndef EVAL
#include "grader.cpp"
#endif // EVAL
#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
int pos[100001][2];
lol find_maximum(int k, vector<vector<int>> x) {
int n = x.size();
lol sum=0,ans=0;
int m = x[0].size(),i,j;
vector<vector<int>> answer;
vector <lol> v;
answer.resize(n);
vector <pii> s;
for (i = 0; i < n; i++){
pos[i][0] = 0;
pos[i][1] = -1;
int a = 0;
for (j=0;j<m;++j){
a += x[i][j];
if (pos[i][1] == -1 && x[i][j])
pos[i][1] = j;
answer[i].pb(-1);
}
s.push_back({a,i});
}
sort(all(s));
for (i=0;i<k;++i){
int c = 0,a=0;
for (pii &y: s){
if (c >= n/2){
a++;
answer[y.sc][pos[y.sc][1]++] = i;
y.fr--;
}
else {
answer[y.sc][pos[y.sc][0]++] = i;
}
c++;
}
ans+=a;
sort(all(s));
}
allocate_tickets(answer);
ret ans;
}
컴파일 시 표준 에러 (stderr) 메시지
tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:30:6: warning: unused variable 'sum' [-Wunused-variable]
30 | lol sum=0,ans=0;
| ^~~
# | 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... |