# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
883474 |
2023-12-05T10:32:54 Z |
ono_de206 |
Rail (IOI14_rail) |
C++17 |
|
376 ms |
98648 KB |
#include "rail.h"
#include<bits/stdc++.h>
using namespace std;
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
//#define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
void findLocation(int n, int first, int pos[], int tp[]) {
pos[0] = first;
tp[0] = 1;
vector<vector<int>> dis(n, vector<int>(n, -1));
auto get = [&](int x, int y) -> int {
if(x > y) swap(x, y);
if(dis[x][y] != -1) return dis[x][y];
return dis[x][y] = getDistance(x, y);
};
for(int i = 1; i < n; i++) {
vector<int> lol;
for(int j = 1; j < n; j++) {
if(i == j) continue;
if(get(0, i) == get(0, j) + get(j, i)) lol.pb(j);
}
int x = first, ls = 0, k = 0;
lol.pb(i);
for(int y : lol) {
if(k) {
x -= get(ls, y);
} else {
x += get(ls, y);
}
ls = y;
k ^= 1;
}
pos[i] = x;
tp[i] = k + 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
520 KB |
Output is correct |
3 |
Correct |
0 ms |
516 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
520 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
520 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
356 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
365 ms |
98648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
376 ms |
98644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |