Submission #857527

# Submission time Handle Problem Language Result Execution time Memory
857527 2023-10-06T10:45:41 Z Trisanu_Das Xylophone (JOI18_xylophone) C++17
0 / 100
1 ms 596 KB
#include <bits/stdc++.h>
using namespace std;
#include "xylophone.h"
 
int a[5001];
 
void solve(int n){
  a[2] = query(1, 2);
  for(int i = 2; i < n; i++){
    int x = query(i, i + 1), y = query(i - 1, i + 1);
    a[i + 1] = a[i] + x * (a[i] - a[i - 1] < 0 ? 1 : -1) * ((y == x) + abs(a[i] - a[i - 1]) ? 1 : -1);
  }
  int mn = *min_element(a + 1, a + n + 1);
  int u, v;
  for(int i = 1; i < n + 1; i++){
    a[i] -= mn;
    if(a[i] == 0) u = i;
    if(a[i] == n - 1) v = i;
  }
  for(int i = 1; i <= n; i++) answer(i, (u < v) ? a[i] + 1 : n - a[i]);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 1 ms 596 KB Wrong Answer [4]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 1 ms 596 KB Wrong Answer [4]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 1 ms 596 KB Wrong Answer [4]
4 Halted 0 ms 0 KB -