# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
74539 |
2018-09-03T11:39:02 Z |
ZZangZZang |
Hokej (COCI17_hokej) |
C++17 |
|
180 ms |
17504 KB |
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <functional>
#include <string>
using namespace std;
struct Player {
int idx, K, I;
bool operator<(Player const& rhs) const {
return K > rhs.K;
}
} pls[500000];
struct Subst {
int X, A, B;
Subst(int X, int A, int B) : X(X), A(A), B(B) {}
};
int M, N;
int main()
{
int i, j;
scanf("%d%d", &M, &N);
for(int i=0; i<N; ++i) {
int K, I;
scanf("%d %d", &K, &I);
pls[i].idx = i+1;
pls[i].K = K;
pls[i].I = I;
}
sort(pls, pls+N);
long long Z = 0LL;
vector<int> starters;
vector<Subst> substs;
int remI = pls[0].I;
i=0;
for(int _=0; _<6; ++_) {
int lastidx = pls[i].idx;
starters.push_back(lastidx);
int tm = remI;
if(tm > M) tm = M;
Z += 1LL*tm*pls[i].K;
j=i;
int I, K, curidx;
I = tm;
while(tm < M) {
++j;
I = pls[j].I;
K = pls[j].K;
int curidx = pls[j].idx;
if(I > M-tm) I = M-tm;
substs.push_back(Subst(tm, lastidx, curidx));
Z += 1LL*I*K;
tm += I;
}
remI = pls[j].I - I;
if(remI == 0) {
++j;
remI = pls[j].I;
}
i = j;
}
printf("%lld\n", Z);
for(i=0; i<6; ++i) {
printf("%d ", starters[i]);
}
puts("");
int sz = substs.size();
printf("%d\n", sz);
for(i=0; i<sz; ++i) {
int X, A, B;
X = substs[i].X;
A = substs[i].A;
B = substs[i].B;
printf("%d %d %d\n", X, A, B);
}
return 0;
}
Compilation message
hokej.cpp: In function 'int main()':
hokej.cpp:50:13: warning: unused variable 'curidx' [-Wunused-variable]
int I, K, curidx;
^~~~~~
hokej.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &M, &N);
~~~~~^~~~~~~~~~~~~~~~
hokej.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &K, &I);
~~~~~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
4 ms |
608 KB |
Output isn't correct |
3 |
Incorrect |
11 ms |
1096 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
1096 KB |
Output isn't correct |
5 |
Incorrect |
6 ms |
1116 KB |
Output isn't correct |
6 |
Incorrect |
3 ms |
1116 KB |
Output isn't correct |
7 |
Incorrect |
5 ms |
1116 KB |
Output isn't correct |
8 |
Incorrect |
119 ms |
3228 KB |
Output isn't correct |
9 |
Incorrect |
180 ms |
12640 KB |
Output isn't correct |
10 |
Incorrect |
180 ms |
17504 KB |
Output isn't correct |