# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
267069 | ChrisT | Travelling Salesperson (CCO20_day2problem1) | C++17 | 1422 ms | 24612 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define all(x) (x).begin(),(x).end()
const int MN = 2e3 + 5;
bool adj[MN][MN];
int main () { //REEEEEE IM SO STUPID
int n;
scanf ("%d",&n);
for (int i = 2; i <= n; i++) {
for (int j = 1; j < i; j++) {
char c; scanf (" %c",&c); adj[i][j] = adj[j][i] = c == 'R';
}
}
if (n == 2) return !printf ("2\n1 2\n2\n2 1\n");
if (n == 3) return !printf ("3\n1 2 3\n3\n2 1 3\n3\n3 1 2\n");
for (int st = 1; st <= n; st++) { //idk just go in some order :tm:
int ed = -1;
vector<vector<int>> conn(n+1);
for (int i = 1; i <= n; i++) if (i != st) {
if (~ed) {
if (conn[ed].empty()) {
conn[ed].push_back(i); conn[i].push_back(ed);
continue;
}
if (conn[ed].size() == 1) {
int other = conn[ed][0];
conn[ed].push_back(i); conn[i].push_back(ed);
conn[other].push_back(i); conn[i].push_back(other);
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |