Submission #358590

# Submission time Handle Problem Language Result Execution time Memory
358590 2021-01-25T23:06:26 Z super_j6 Last supper (IOI12_supper) C++14
0 / 100
83 ms 9580 KB
#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(unsigned char *a, int n, int k, int m){
	for(int i = 0; i < k; i++){
		f[i] = 1;
		if(!(a[i] & 1)) 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] & 1)) v.push(x);
		f[x] = 1;
	}
}
/*
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
 
	int n, m, k;
	cin >> n >> k >> m;
 
	unsigned char a[m];
	for(int i = 0; i < m; i++) cin >> a[i];
 
	Assist(a, n, k, m);
	
	cout << endl;
 
	return 0;
}
*/
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2280 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 3052 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 7140 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2472 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 8168 KB Error - Putting back a color that is not on the scaffold
2 Runtime error 83 ms 9580 KB Execution killed with signal 11
3 Incorrect 79 ms 8512 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 81 ms 8692 KB Output isn't correct - not an optimal way
5 Incorrect 83 ms 8668 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 79 ms 8524 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 78 ms 8512 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 80 ms 8384 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 79 ms 8520 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 78 ms 7796 KB Output isn't correct - not an optimal way