HELLO!
In this problem: PROBLEM
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int t, k;
ll c, n;
ll a, b;
bool flag = 1;
int main() {
cin >> t;
while (t--) {
cin >> c >> n >> k;
if (k == 0) {
vector < ll > col(c + 1, 0);
for (int i = 0; i < n; ++i) {
cin >> a >> b;
if (flag == 0) {
break;
}
for (int j = a; j <= b; ++j) {
if (col[j] == 1) {
flag = 0;
break;
} else {
col[j] = 1;
}
}
flag = 1;
}
if (flag == 0) {
cout << "Bad";
} else {
cout << "Good";
}
cout << "\n";
} else {
ll sum = 0;
for (int i = 0; i < n; ++i) {
cin >> a >> b;
sum += b - a + 1;
if (sum > c) {
flag = 0;
break;
}
}
if (flag == 0) {
cout << "Bad";
} else {
cout << "Good";
}
cout << "\n";
}
}
}
I have used appearance array for first, for second case that is k=1, i wasn’t able to think more and more about the solution so i just did what was obvious,
And…
I am getting this error
Along with 3 Right Task, I want to know How can i make it better?