제출 #702818

#제출 시각아이디문제언어결과실행 시간메모리
702818kxdXylophone (JOI18_xylophone)C++17
0 / 100
0 ms336 KiB
#include "xylophone.h" #include <bits/stdc++.h> //#define int long long #define ll long long #define pb push_back #define p_q priority_queue #define m_p make_pair #define pii pair<int,int> #define endl '\n' #define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FOR(i, a, b) for(int i = a; i <= b; i++) #define forn(i, n) for (int i = 0; i < n; i++) #define forn1(i, n) for (int i = 1; i <= n; i++) #define all(x) x.begin(),x.end() #define ft first #define sd second using namespace std; const int N = 6969; const int INF = 1e9; const int MOD = 1e9+7; int a[N]; int nx2[N]; int nx3[N]; bool b[N]; void solve(int n) { memset(a,0,sizeof(a)); memset(nx2,0,sizeof(nx2)); memset(nx3,0,sizeof(nx3)); memset(b,0,sizeof(b)); forn1(i,n) { nx2[i] = query(i, i+1); } forn1(i,n-1) { nx3[i] = query(i, i+2); } FOR(i,2,n-1) { b[i] = (nx3[i-1] != nx2[i]+nx2[i-1]); } a[1] = 1; bool flag = 1; FOR(i,2,n) { a[i] = a[i-1]; if(flag) { a[i] += nx2[i-1]; } else { a[i] -= nx2[i-1]; } flag = (flag!=b[i]); } int mini = 0; a[0]=INF; forn1(i,n) { if(a[i] < a[mini]) mini = i; } int pos1 = -1; int posn = -1; forn1(i,n) { a[i] += 1-a[mini]; if(a[i] == 1) pos1 = i; if(a[i] == n) posn = i; } if(pos1>posn) { forn1(i,n) { a[i] = n+1-a[i]; } } forn1(i,n) { answer(i, a[i]); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...