# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
45313 | 2018-04-12T19:58:42 Z | imaxblue | Tales of seafaring (POI13_mor) | C++17 | 482 ms | 12028 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define x first #define y second #define pii pair<int, int> #define p3i pair<pii, int> #define pll pair<ll, ll> #define p3l pair<pll, ll> #define vi vector<int> #define vpii vector<pii> #define vp3i vector<p3i> #define vpll vector<pll> #define vp3l vector<p3l> #define lseg L, (L+R)/2, N*2+1 #define rseg (L+R)/2+1, R, N*2+2 #define ub upper_bound #define lb lower_bound #define PQ priority_queue #define MN 1000000007 #define fox(k, x) for (int k=0; k<x; ++k) #define fox1(k, x) for (int k=1; k<=x; ++k) #define foxr(k, x) for (int k=x-1; k>=0; --k) #define fox1r(k, x) for (int k=x; k>0; --k) #define ms multiset #define flood(x) memset(x, 0x3f3f3f3f, sizeof x) #define drain(x) memset(x, 0, sizeof x) #define rng() ((rand() << 14)+rand()) #define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0) char _; #define pi 3.14159265358979323846 //#define short int #define top front short d[2][1005][1005]; int n, m, q, x, y, w, N, D; bool T; bitset<5005> u[2][5005]; vector<short> v[5005]; queue<pair<short, short> > pq; void dijk(int S){ pq.push(mp(0, S*2)); while(!pq.empty()){ D=pq.top().x; T=pq.top().y%2; N=pq.top().y/2; pq.pop(); if (u[T][S][N]) continue; d[T][S][N]=D; u[T][S][N]=1; fox(l, v[N].size()){ if (!u[!T][S][v[N][l]]) pq.push(mp(D+1, v[N][l]*2+!T)); } } } int32_t main(){ scanf("%i%i%i", &n, &m, &q); fox(l, m){ scanf("%i%i", &x, &y); v[x].pb(y); v[y].pb(x); } fox1(l, n){ dijk(l); } fox(l, q){ scanf("%i%i%i", &x, &y, &w); if (u[w%2][x][y] && d[w%2][x][y]<=w){ printf("TAK\n"); } else { printf("NIE\n"); } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 468 KB | Output is correct |
2 | Incorrect | 2 ms | 580 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 580 KB | Output is correct |
2 | Correct | 2 ms | 672 KB | Output is correct |
3 | Incorrect | 2 ms | 680 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 884 KB | Output is correct |
2 | Correct | 2 ms | 928 KB | Output is correct |
3 | Correct | 3 ms | 1004 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 2796 KB | Output is correct |
2 | Correct | 5 ms | 2796 KB | Output is correct |
3 | Correct | 43 ms | 3340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 80 ms | 3864 KB | Output is correct |
2 | Correct | 19 ms | 4916 KB | Output is correct |
3 | Incorrect | 130 ms | 4916 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 227 ms | 11580 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 473 ms | 11732 KB | Execution killed with signal 7 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 482 ms | 11884 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 375 ms | 12028 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 464 ms | 12028 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |