QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#636321 | #9462. Safest Buildings | ucup-team191# | Compile Error | / | / | C++23 | 893b | 2024-10-12 23:21:23 | 2024-10-12 23:21:24 |
Judging History
answer
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
#define PB push_back
using namespace std;
typedef pair < int, int > pii;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
int T; cin >> T;
for(;T--;) {
int n, r, R; scanf("%d%d%d", &n, &R, &r);
vector < pii > v;
for(int i = 1;i <= n;i++) {
int x, y; scanf("%d%d", &x, &y);
v.PB({x * x + y * y, i});
}
sort(v.begin(), v.end());
int ans = 0;
if(v[0].first <= (R - r) * (R - r)) {
for(pii x : v) ans += x.first <= (R - r) * (R - r);
printf("%d\n", ans);
for(pii x : v) if(x.first <= (R - r) * (R - r)) printf("%d ", x.second);
printf("\n");
} else {
for(pii x : v) ans += x.first == v[0].first;
printf("%d\n", ans);
for(pii x : v) if(x.first == v[0].first) printf("%d ", x.second);
printf("\n");
}
}
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:17:17: error: ‘vector’ was not declared in this scope 17 | vector < pii > v; | ^~~~~~ answer.code:5:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 4 | #include <algorithm> +++ |+#include <vector> 5 | answer.code:17:30: error: expected primary-expression before ‘>’ token 17 | vector < pii > v; | ^ answer.code:17:32: error: ‘v’ was not declared in this scope 17 | vector < pii > v; | ^ answer.code:16:35: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | int n, r, R; scanf("%d%d%d", &n, &R, &r); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~ answer.code:19:40: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | int x, y; scanf("%d%d", &x, &y); | ~~~~~^~~~~~~~~~~~~~~~