# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
271207 |
2020-08-18T05:10:57 Z |
임성재(#5104) |
Last supper (IOI12_supper) |
C++14 |
|
0 ms |
0 KB |
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
static queue<int> q[100010];
static set<pii> s;
static vector<int> ans;
static mx;
void ComputeAdvice(int *C, int N, int K, int M) {
while(N >> mx) mx++;
for(int i=0; i<N; i++) {
q[C[i]].em(i);
}
for(int i=0; i<N; i++)
q[i].em(N);
for(int i=0; i<K; i++) {
s.insert(mp(q[i].front(), i));
}
for(int i=0; i<N; i++) {
if(s.begin()->fi == i) {
int x = s.begin()->se;
q[x].pop();
s.erase(s.begin());
s.insert(mp(q[x].front(), x));
ans.eb(N);
}
else {
int x = prev(s.end())->se;
s.erase(prev(s.end()));
q[C[i]].pop();
s.insert(mp(q[C[i]].front(), C[i]));
ans.eb(x);
}
}
for(auto i : ans) {
for(int j=0; j<mx; j++) {
if(i & (1<<j)) WriteAdvice(1);
else WriteAdvice(0);
}
}
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
static int mx;
void Assist(unsigned char *A, int N, int K, int R) {
while(N >> mx) mx++;
for(int i=0; i<N; i++) {
int b = 0;
for(int j=0; j<mx; j++) {
if(A[i*mx + j]) b |= (1<<j);
}
GetRequest();
if(b < N) PutBack(b);
}
}
Compilation message
advisor.cpp:22:8: error: 'mx' does not name a type; did you mean 'mp'?
22 | static mx;
| ^~
| mp
advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:25:14: error: 'mx' was not declared in this scope; did you mean 'mp'?
25 | while(N >> mx) mx++;
| ^~
| mp
advisor.cpp:60:20: error: 'mx' was not declared in this scope; did you mean 'mp'?
60 | for(int j=0; j<mx; j++) {
| ^~
| mp