| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1333793 | YSH2020 | Laser Strike (EGOI25_laserstrike) | C++17 | 5 ms | 420 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int P, N;
cin >> P >> N;
if (P == 1) {
vector<int> a(N - 1);
vector<int> b(N - 1);
int counts[N]; memset(counts,0,sizeof(counts));
int taken[N-1];
for (int i = 0; i < N - 1; ++i) {
cin >> a[i] >> b[i];
counts[a[i]]++;
counts[b[i]]++;
taken[i]=0;
}
int start;
for (int i = 0; i < N; i++) if (counts[i]==1) start = i;
string message = "0";
vector<int> l;
for (int i = 0; i < N-1; i++) {
for (int j = 0; j < N-1; j++) if (taken[j]==0 && (a[j]==start||b[j]==start)) {
int other = a[j]^b[j]^start;
if (i==0) {
if (other < start) message="1";
}
l.push_back(start);
start = other;
taken[j]=1;
}
}
cout << message << endl;
for (int i = 0; i < N - 1; ++i) {
cout << l[i] << endl;
}
} else {
cin.ignore(100, '\n');
string message;
getline(cin, message);
int past;
for (int i = 0; i < N - 1; ++i) {
int a, b;
cin >> a >> b;
if (i==0) {
if (message=="1") {
cout << b << endl;
past = a;
}
else {
cout << a << endl;
past = b;
}
}
else {
cout << past << endl;
past = past^a^b;
}
}
}
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
