# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
363094 |
2021-02-05T04:45:48 Z |
8e7 |
Last supper (IOI12_supper) |
C++14 |
|
528 ms |
21084 KB |
//Challenge: Accepted
#include "advisor.h"
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#define ll long long
#define maxn 100005
#define mod 1000000000
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int hbit(int x) {
int ret = 0;
while (x) {
ret++, x >>= 1;
}
return ret;
}
void ComputeAdvice(int *C, int N, int K, int M) {
int bit = max(1, hbit(N - 1));
for (int i = 0;i < N;i++) {
for (int j = 0;j < bit;j++) {
WriteAdvice((C[i] & (1<<j)) ? 1 : 0);
}
}
}
//Challenge: Accepted
#include "assistant.h"
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#define ll long long
#define maxn 100005
#define mod 1000000000
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
namespace {
int hbit(int x) {
int ret = 0;
while (x) {
ret++, x >>= 1;
}
return ret;
}
int a[maxn], ind[maxn];
vector<int> ti[maxn];
bool found[maxn];
set<pii> se;
}
void Assist(unsigned char *A, int N, int K, int R) {
int bit = max(1, hbit(N - 1));
int id = 0;
for (int i = 0;i < N;i++) {
for (int j = 0;j < bit;j++) {
a[i] += A[id] ? (1<<j) : 0;
id++;
}
ti[a[i]].push_back(i);
}
for (int i = 0;i < N;i++) ti[i].push_back(1<<30);
for (int i = 0;i < K;i++) {
se.insert(make_pair(ti[i][0], i));
}
for (int i = 0;i < N;i++) {
int x = GetRequest();
if ((*se.begin()).ff == i) {
pii cur = *se.begin();
se.erase(se.begin());
ind[cur.ss]++;
cur.ff = ti[cur.ss][ind[cur.ss]];
se.insert(cur);
} else {
pii cur = *prev(se.end());
PutBack(cur.ss);
se.erase(prev(se.end()));
ind[x]++;
se.insert(make_pair(ti[x][ind[x]], x));
}
}
}
Compilation message
assistant.cpp:27:6: warning: '{anonymous}::found' defined but not used [-Wunused-variable]
27 | bool found[maxn];
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
3044 KB |
Output is correct |
2 |
Correct |
3 ms |
3284 KB |
Output is correct |
3 |
Correct |
6 ms |
3400 KB |
Output is correct |
4 |
Correct |
12 ms |
3512 KB |
Output is correct |
5 |
Correct |
19 ms |
3708 KB |
Output is correct |
6 |
Correct |
19 ms |
3708 KB |
Output is correct |
7 |
Correct |
19 ms |
3836 KB |
Output is correct |
8 |
Correct |
19 ms |
3844 KB |
Output is correct |
9 |
Correct |
19 ms |
3708 KB |
Output is correct |
10 |
Correct |
22 ms |
4116 KB |
Output is correct |
11 |
Correct |
20 ms |
3852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
4672 KB |
Output is correct |
2 |
Correct |
226 ms |
11236 KB |
Output is correct |
3 |
Correct |
524 ms |
21084 KB |
Output is correct |
4 |
Correct |
464 ms |
19292 KB |
Output is correct |
5 |
Correct |
480 ms |
19404 KB |
Output is correct |
6 |
Correct |
490 ms |
19736 KB |
Output is correct |
7 |
Correct |
501 ms |
20308 KB |
Output is correct |
8 |
Correct |
432 ms |
18308 KB |
Output is correct |
9 |
Correct |
449 ms |
19432 KB |
Output is correct |
10 |
Correct |
506 ms |
20860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
403 ms |
17120 KB |
Output is correct |
2 |
Incorrect |
24 ms |
4976 KB |
Error - advice is too long |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
3264 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
505 ms |
20300 KB |
Output is partially correct - 1700000 bits used |
2 |
Correct |
493 ms |
20484 KB |
Output is partially correct - 1700000 bits used |
3 |
Correct |
515 ms |
20368 KB |
Output is partially correct - 1700000 bits used |
4 |
Correct |
528 ms |
20576 KB |
Output is partially correct - 1700000 bits used |
5 |
Correct |
499 ms |
20364 KB |
Output is partially correct - 1700000 bits used |
6 |
Correct |
503 ms |
20676 KB |
Output is partially correct - 1700000 bits used |
7 |
Correct |
504 ms |
20412 KB |
Output is partially correct - 1697263 bits used |
8 |
Correct |
508 ms |
20768 KB |
Output is partially correct - 1700000 bits used |
9 |
Correct |
489 ms |
20620 KB |
Output is partially correct - 1700000 bits used |
10 |
Correct |
511 ms |
20568 KB |
Output is partially correct - 1700000 bits used |