Submission #918653

#TimeUsernameProblemLanguageResultExecution timeMemory
918653hasanovrCoins (IOI17_coins)C++14
Compilation error
0 ms0 KiB
#include "coins.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> coin_flips(vector<int> a, int c) {
    vector<int> ans;
	if(!a[c])
		ans.push_back(c);
	for(int i=0; i<64; i++)
		if(x!=i and a[i])
			ans.push_back(i);
	if(ans.empty()){
		ans.push_back(x);
		ans.push_back(x);
	}
	return ans;
}

int find_coin(vector<int> a) {
    for(int i=0; i<64; i++)
        if(a[i]) return i; 
    return -1;   
}

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:10:6: error: 'x' was not declared in this scope
   10 |   if(x!=i and a[i])
      |      ^
coins.cpp:13:17: error: 'x' was not declared in this scope
   13 |   ans.push_back(x);
      |                 ^