QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#360611 | #8166. Almost Large | ucup-team1198# | WA | 0ms | 3848kb | C++20 | 1.5kb | 2024-03-21 22:35:51 | 2024-03-21 22:35:51 |
Judging History
answer
#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <queue>
using namespace std;
vector<int> here[12][3];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<int> s(n);
for (int i = 0; i < n; ++i) cin >> s[i];
for (int i = 1; i < n; ++i) {
int me = s[i];
for (int j = 0; j < 12; ++j) {
here[j][me % 3].push_back(i);
me /= 3;
}
}
queue<int> burn;
burn.push(0);
vector<int> used(n);
used[0] = 1;
while (!burn.empty()) {
int h = burn.front();
if (h == n - 1) {
cout << "Yes\n";
return 0;
}
burn.pop();
int me = s[h];
for (int j = 0; j < 12; ++j) {
int mj = me % 3;
for (int u = 0; u < mj; ++u) {
for (int at : here[j][u]) {
if (!used[at]) {
burn.push(at);
used[at] = 1;
}
}
here[j][u].clear();
}
me /= 3;
}
}
cout << "No\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3848kb
input:
2 21 14
output:
Yes
result:
ok answer is YES
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3640kb
input:
2 12 1
output:
Yes
result:
wrong answer expected NO, found YES