# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
704278 |
2023-03-02T02:35:48 Z |
vjudge1 |
Park (JOI17_park) |
C++17 |
|
229 ms |
468 KB |
#include <bits/stdc++.h>
#include "park.h"
using namespace std;
typedef long long ll;
void answer(int a, int b){
Answer(min(a, b), max(a, b));
}
namespace subtask1{
void solve(int n){
for (int i=0; i<n; i++){
for (int j=i+1; j<n; j++){
vector<int> a(n, 0);
a[i] = a[j] = 1;
if (Ask(i, j, a.data())){
answer(i, j);
}
}
}
}
};
namespace subtask2{
bool in_middle(int n, int a, int b, int c){
vector<int> place(n, 1);
place[b] = 0;
return Ask(a, c, place.data()) == 0;
}
void solve(int n){
int idx1 = 0, idx2 = 1;
for (int i=2; i<n; i++){
if (in_middle(n, idx1, i, idx2)) continue;
if (in_middle(n, idx1, idx2, i)){
idx2 = i;
}
else{
idx1 = i;
}
}
vector<int> a;
for (int i=0; i<n; i++){
if (i != idx1) a.push_back(i);
}
sort(a.begin(), a.end(), [&](int x, int y){
if (x == y) return false;
return in_middle(n, idx1, x, y);
});
answer(idx1, a[0]);
for (int i=1; i<a.size(); i++){
answer(a[i-1], a[i]);
}
}
};
void Detect(int T, int N){
if (T == 1){
subtask1::solve(N);
}
else if (T == 2){
subtask2::solve(N);
}
}
Compilation message
park.cpp: In function 'void subtask2::solve(int)':
park.cpp:47:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
47 | for (int i=1; i<a.size(); i++){
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
6 ms |
212 KB |
Output is correct |
3 |
Correct |
6 ms |
324 KB |
Output is correct |
4 |
Correct |
9 ms |
324 KB |
Output is correct |
5 |
Correct |
6 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
224 ms |
448 KB |
Output is correct |
2 |
Correct |
104 ms |
448 KB |
Output is correct |
3 |
Correct |
129 ms |
460 KB |
Output is correct |
4 |
Correct |
225 ms |
468 KB |
Output is correct |
5 |
Correct |
229 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |