Submission #358588

#TimeUsernameProblemLanguageResultExecution timeMemory
358588super_j6Last supper (IOI12_supper)C++14
Compilation error
0 ms0 KiB
#include "advisor.h" #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <vector> #include <queue> using namespace std; #define endl '\n' #define ll long long #define pi pair<int, int> #define f first #define s second const int mxn = 200000; int b[mxn], f[mxn], p[mxn], ans[mxn]; priority_queue<pi> pq; /* void WriteAdvice(int x){ cout << x << " ";} */ void ComputeAdvice(int *a, int n, int k, int m){ memset(b, -1, sizeof(b)); memset(p, 0x3f, sizeof(p)); for(int i = n - 1; ~i; i--) f[i] = p[a[i]], p[a[i]] = i; for(int i = 0; i < k; i++) pq.push({p[i], b[i] = i}); for(int i = 0; i < n; i++){ if(~b[a[i]]) ans[b[a[i]]] = 1; else b[pq.top().s] = -1, pq.pop(); b[a[i]] = i + k, pq.push({f[i], a[i]}); } for(int i = 0; i < n + k; i++) WriteAdvice(ans[i]); } /* int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> k >> m; int a[n]; for(int i = 0; i < n; i++) cin >> a[i]; ComputeAdvice(a, n, k, m); cout << endl; return 0; } */
#include "assistant.h" #include <iostream> #include <cstdio> #include <algorithm> #include <stack> using namespace std; #define endl '\n' #define ll long long #define pi pair<int, int> #define f first #define s second const int mxn = 100000; int f[mxn]; stack<int> v; /* int GetRequest(){ int x; cin >> x; return x; } void PutBack(int x){ cout << x << " ";} */ void Assist(int *a, int n, int k, int m){ for(int i = 0; i < k; i++){ f[i] = 1; if(!a[i]) v.push(i); } for(int i = 0; i < n; i++){ int x = GetRequest(); if(!f[x]) f[v.top()] = 0, PutBack(v.top()), v.pop(); if(!a[k + x]) v.push(x); f[x] = 1; } } /* int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> k >> m; int a[m]; for(int i = 0; i < m; i++) cin >> a[i]; Assist(a, n, k, m); cout << endl; return 0; } */

Compilation message (stderr)

/tmp/cczhGdWf.o: In function `main':
assistant_grader.cpp:(.text.startup+0x23f): undefined reference to `Assist(unsigned char*, int, int, int)'
collect2: error: ld returned 1 exit status