답안 #213556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
213556 2020-03-26T06:17:03 Z erd1 Xylophone (JOI18_xylophone) C++14
100 / 100
121 ms 1144 KB
#include "xylophone.h"
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
static int A[5000];

map<pair<int, int>, int> qs;
int ask(int l, int r){
l++; r++;
    if(qs[{l, r}])return qs[{l, r}];
    return qs[{l, r}] = query(l, r);
}
vector<int> ans;
void solve(int N) {
    int ldir = 1;
    ans.pb(0);
    ans.pb(ask(0, 1));
    for(int i = 2; i < N; i++){
        if(ask(i-2, i) != ask(i-1, i)+ask(i-2, i-1))ldir = -ldir;
        ans.pb(ans.back()+ask(i-1, i)*ldir);
    }
    //for(auto i: ans)cout << i << endl;
    int a = *min_element(ans.begin(), ans.end());
    for(auto& i: ans)i-=a-1;
    //for(auto i: ans)cout << i << endl;
    if(min_element(all(ans)) > max_element(all(ans)))
        for(auto& i: ans)i = N+1-i;
    //for(auto i: ans)cout << i << endl;
	for(int i = 0; i < N; i++) {
		answer(i+1, ans[i]);
	}

}

Compilation message

xylophone.cpp:8:12: warning: 'A' defined but not used [-Wunused-variable]
 static int A[5000];
            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 7 ms 380 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 7 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 7 ms 256 KB Output is correct
14 Correct 9 ms 384 KB Output is correct
15 Correct 7 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 7 ms 380 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 7 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 7 ms 256 KB Output is correct
14 Correct 9 ms 384 KB Output is correct
15 Correct 7 ms 384 KB Output is correct
16 Correct 10 ms 384 KB Output is correct
17 Correct 13 ms 392 KB Output is correct
18 Correct 26 ms 384 KB Output is correct
19 Correct 27 ms 512 KB Output is correct
20 Correct 28 ms 384 KB Output is correct
21 Correct 30 ms 384 KB Output is correct
22 Correct 26 ms 384 KB Output is correct
23 Correct 28 ms 504 KB Output is correct
24 Correct 29 ms 504 KB Output is correct
25 Correct 24 ms 384 KB Output is correct
26 Correct 21 ms 512 KB Output is correct
27 Correct 30 ms 504 KB Output is correct
28 Correct 20 ms 384 KB Output is correct
29 Correct 32 ms 504 KB Output is correct
30 Correct 28 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 7 ms 380 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 7 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 7 ms 256 KB Output is correct
14 Correct 9 ms 384 KB Output is correct
15 Correct 7 ms 384 KB Output is correct
16 Correct 10 ms 384 KB Output is correct
17 Correct 13 ms 392 KB Output is correct
18 Correct 26 ms 384 KB Output is correct
19 Correct 27 ms 512 KB Output is correct
20 Correct 28 ms 384 KB Output is correct
21 Correct 30 ms 384 KB Output is correct
22 Correct 26 ms 384 KB Output is correct
23 Correct 28 ms 504 KB Output is correct
24 Correct 29 ms 504 KB Output is correct
25 Correct 24 ms 384 KB Output is correct
26 Correct 21 ms 512 KB Output is correct
27 Correct 30 ms 504 KB Output is correct
28 Correct 20 ms 384 KB Output is correct
29 Correct 32 ms 504 KB Output is correct
30 Correct 28 ms 384 KB Output is correct
31 Correct 47 ms 548 KB Output is correct
32 Correct 76 ms 732 KB Output is correct
33 Correct 76 ms 888 KB Output is correct
34 Correct 92 ms 1016 KB Output is correct
35 Correct 118 ms 1080 KB Output is correct
36 Correct 112 ms 1024 KB Output is correct
37 Correct 93 ms 1144 KB Output is correct
38 Correct 58 ms 1004 KB Output is correct
39 Correct 110 ms 1008 KB Output is correct
40 Correct 87 ms 1016 KB Output is correct
41 Correct 98 ms 1016 KB Output is correct
42 Correct 57 ms 1008 KB Output is correct
43 Correct 90 ms 1016 KB Output is correct
44 Correct 99 ms 1016 KB Output is correct
45 Correct 114 ms 1016 KB Output is correct
46 Correct 93 ms 1016 KB Output is correct
47 Correct 88 ms 1016 KB Output is correct
48 Correct 84 ms 1016 KB Output is correct
49 Correct 108 ms 1044 KB Output is correct
50 Correct 90 ms 1016 KB Output is correct
51 Correct 101 ms 1016 KB Output is correct
52 Correct 117 ms 1144 KB Output is correct
53 Correct 92 ms 1016 KB Output is correct
54 Correct 115 ms 1016 KB Output is correct
55 Correct 95 ms 1020 KB Output is correct
56 Correct 121 ms 1016 KB Output is correct
57 Correct 91 ms 1016 KB Output is correct
58 Correct 91 ms 1016 KB Output is correct
59 Correct 94 ms 1016 KB Output is correct
60 Correct 102 ms 1044 KB Output is correct