제출 #871476

#제출 시각아이디문제언어결과실행 시간메모리
871476NeroZeinTenis (COI19_tenis)C++17
30 / 100
1062 ms5092 KiB
#include "bits/stdc++.h" using namespace std; #ifdef Nero #include "Deb.h" #else #define deb(...) #endif int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; vector<vector<int>> a(3, vector<int> (n)); vector<vector<int>> idx(3, vector<int> (n)); for (int i = 0; i < 3; ++i) { for (int j = 0; j < n; ++j) { cin >> a[i][j]; --a[i][j]; idx[i][a[i][j]] = j; } } auto get_first = [&](int x) { return min({idx[0][x], idx[1][x], idx[2][x]}); }; auto get_last = [&](int x) { return max({idx[0][x], idx[1][x], idx[2][x]}); }; while (q--) { int tp; cin >> tp; if (tp == 1) { int x; cin >> x; --x; int f = get_first(x); int c = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < 3; ++j) { c = max(c, get_last(a[j][i])); } if (c == i) break; } cout << (c >= f ? "DA" : "NE") << '\n'; } else { int p, x, y; cin >> p >> x >> y; --p, --x, --y; int px = idx[p][x]; int py = idx[p][y]; swap(idx[p][x], idx[p][y]); a[p][px] = y; a[p][py] = x; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...