Submission #939447

# Submission time Handle Problem Language Result Execution time Memory
939447 2024-03-06T11:23:40 Z JakobZorz Xylophone (JOI18_xylophone) C++17
100 / 100
62 ms 600 KB
#include"xylophone.h"
#include<iostream>
#include<vector>
using namespace std;

void solve(int n){
    vector<int>res(n);
    res[0]=0;
    res[1]=query(1,2);
    int mn=0;
    
    for(int i=2;i<n;i++){
        int r1=query(i,i+1);
        int r2=query(i-1,i+1);
        res[i]=res[i-1]+r1;
        if(max(max(res[i-2],res[i-1]),res[i])-min(min(res[i-2],res[i-1]),res[i])!=r2)
            res[i]=res[i-1]-r1;
        mn=min(mn,res[i]);
    }
    for(int&i:res)
        i-=mn-1;
    
    bool gotn=false;
    for(int i:res){
        if(i==n)
            gotn=true;
        if(i==1&&gotn){
            for(int&i:res)
                i=n-i+1;
            break;
        }
    }
    
    for(int i=0;i<n;i++)
        answer(i+1,res[i]);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 388 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 356 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 388 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 356 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 4 ms 440 KB Output is correct
18 Correct 8 ms 344 KB Output is correct
19 Correct 10 ms 432 KB Output is correct
20 Correct 11 ms 428 KB Output is correct
21 Correct 8 ms 436 KB Output is correct
22 Correct 10 ms 600 KB Output is correct
23 Correct 7 ms 440 KB Output is correct
24 Correct 7 ms 444 KB Output is correct
25 Correct 7 ms 432 KB Output is correct
26 Correct 9 ms 344 KB Output is correct
27 Correct 9 ms 440 KB Output is correct
28 Correct 8 ms 440 KB Output is correct
29 Correct 12 ms 344 KB Output is correct
30 Correct 7 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 388 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 356 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 4 ms 440 KB Output is correct
18 Correct 8 ms 344 KB Output is correct
19 Correct 10 ms 432 KB Output is correct
20 Correct 11 ms 428 KB Output is correct
21 Correct 8 ms 436 KB Output is correct
22 Correct 10 ms 600 KB Output is correct
23 Correct 7 ms 440 KB Output is correct
24 Correct 7 ms 444 KB Output is correct
25 Correct 7 ms 432 KB Output is correct
26 Correct 9 ms 344 KB Output is correct
27 Correct 9 ms 440 KB Output is correct
28 Correct 8 ms 440 KB Output is correct
29 Correct 12 ms 344 KB Output is correct
30 Correct 7 ms 432 KB Output is correct
31 Correct 21 ms 420 KB Output is correct
32 Correct 26 ms 420 KB Output is correct
33 Correct 37 ms 452 KB Output is correct
34 Correct 46 ms 448 KB Output is correct
35 Correct 42 ms 452 KB Output is correct
36 Correct 47 ms 452 KB Output is correct
37 Correct 48 ms 448 KB Output is correct
38 Correct 47 ms 428 KB Output is correct
39 Correct 50 ms 448 KB Output is correct
40 Correct 49 ms 428 KB Output is correct
41 Correct 41 ms 428 KB Output is correct
42 Correct 52 ms 432 KB Output is correct
43 Correct 52 ms 428 KB Output is correct
44 Correct 40 ms 444 KB Output is correct
45 Correct 56 ms 428 KB Output is correct
46 Correct 55 ms 452 KB Output is correct
47 Correct 45 ms 448 KB Output is correct
48 Correct 46 ms 432 KB Output is correct
49 Correct 62 ms 432 KB Output is correct
50 Correct 55 ms 436 KB Output is correct
51 Correct 46 ms 432 KB Output is correct
52 Correct 46 ms 452 KB Output is correct
53 Correct 53 ms 448 KB Output is correct
54 Correct 50 ms 428 KB Output is correct
55 Correct 45 ms 428 KB Output is correct
56 Correct 40 ms 448 KB Output is correct
57 Correct 56 ms 436 KB Output is correct
58 Correct 48 ms 428 KB Output is correct
59 Correct 43 ms 436 KB Output is correct
60 Correct 46 ms 432 KB Output is correct