Submission #314540

#TimeUsernameProblemLanguageResultExecution timeMemory
314540baibhav26062008Handcrafted Gift (IOI20_gift)C++14
Compilation error
0 ms0 KiB
#include "gift.h"
#include <bits/stdc++.h>
using namespace std;

int construct(int n, int r, vector<int> a, vector<int> b, vector<int> x) {
	string s;
	if (x[0] == 1) {
		for (int i = 0; i < n; i++) {
			ans += "R";
		}
	} 
	
	for (int i = 0; i < r; i++) {
		if (a[i] == b[i]) {
			return 0;
		}
	}
	if(x[0] == 2) {
		for (int j = 0; j < n; j++) {
			if (j % 2 == 0) {
				s += "R";
			} else {
				s += "B";
			}
		}
	} else {
		for (int j = 0; j < n; j++) {
			s += "R";
		}
	}
    craft(s);
    return 1;
}

Compilation message (stderr)

gift.cpp: In function 'int construct(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
gift.cpp:9:4: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |    ans += "R";
      |    ^~~
      |    abs