# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1051081 |
2024-08-09T19:22:33 Z |
beaconmc |
Spy 3 (JOI24_spy3) |
C++17 |
|
162 ms |
9248 KB |
#include "Aoi.h"
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
namespace {
const ll INF = 10000000000000000;
const ll maxn = 10005;
vector<vector<ll>> edges[maxn];
vector<ll> prevs[maxn];
ll dists[maxn];
bool visited[maxn];
} // namespace
string aoi(int N, int M, int Q, int K, vector<int> A,vector<int> B, vector<long long> C,
vector<int> T, vector<int> X) {
string ans;
FOR(i,0,M){
edges[A[i]].push_back({B[i], C[i], i});
edges[B[i]].push_back({A[i], C[i], i});
}
FOR(i,0,Q){
FOR(k,0,maxn) dists[k] = INF, prevs[k] = {-1, -1}, visited[k] = 0;
priority_queue<vector<ll>> pq;
dists[0] = 0;
pq.push({0, 0});
while (pq.size()){
vector<ll> node = pq.top();
if (node[1] == T[i]) break;
pq.pop();
node[0] = -node[0];
if (node[0] != dists[node[1]]) continue;
for (auto&i : edges[node[1]]){
if (dists[i[0]] > node[0] + i[1]){
prevs[i[0]] = {node[1], i[2]};
dists[i[0]] = node[0] + i[1];
pq.push({-dists[i[0]], i[0]});
}
}
}
unordered_set<ll> stuff;
ll cur = T[i];
while (prevs[cur][1] != -1){
stuff.insert(prevs[cur][1]);
cur = prevs[cur][0];
}
FOR(j,0,K){
if (stuff.count(X[j])) ans += '1';
else ans += '0';
}
}
return ans;
}
#include "Bitaro.h"
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
namespace {
const ll INF = 10000000000000000;
const ll maxn = 10005;
vector<array<ll,3>> edges[maxn];
vector<ll> prevs[maxn];
ll dists[maxn];
bool visited[maxn];
} // namespace
void bitaro(int N, int M, int Q, int K, vector<int> A, vector<int> B,
vector<long long> C, vector<int> T, vector<int> X,
string s) {
FOR(i,0,M){
edges[A[i]].push_back({B[i], C[i], i});
edges[B[i]].push_back({A[i], C[i], i});
}
FOR(i,0,Q){
FOR(k,0,maxn) dists[k] = INF, prevs[k] = {-1, -1}, visited[k] = 0;
unordered_set<ll> idk;
FOR(j, K*i, K*(i+1)){
if (s[j] == '1') idk.insert(X[j-K*i]);
}
unordered_set<ll> idkman;
for (auto&i : X) idkman.insert(i);
FOR(i,0,maxn){
for (auto&j : edges[i]){
if (idk.count(j[2])) j[1] = 1;
else if (idkman.count(j[2])) j[1] = INF;
}
}
priority_queue<vector<ll>> pq;
dists[0] = 0;
pq.push({0, 0});
while (pq.size()){
vector<ll> node = pq.top();
if (node[1] == T[i]) break;
pq.pop();
node[0] = -node[0];
if (node[0] != dists[node[1]]) continue;
for (auto&i : edges[node[1]]){
if (dists[i[0]] > node[0] + i[1]){
prevs[i[0]] = {node[1], i[2]};
dists[i[0]] = node[0] + i[1];
pq.push({-dists[i[0]], i[0]});
}
}
}
vector<int> stuff;
ll cur = T[i];
while (prevs[cur][1] != -1){
stuff.push_back(prevs[cur][1]);
cur = prevs[cur][0];
}
reverse(stuff.begin(), stuff.end());
answer(stuff);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
23 ms |
7612 KB |
Partially correct |
2 |
Correct |
2 ms |
2316 KB |
Output is correct |
3 |
Partially correct |
61 ms |
7228 KB |
Partially correct |
4 |
Partially correct |
55 ms |
7116 KB |
Partially correct |
5 |
Partially correct |
74 ms |
7096 KB |
Partially correct |
6 |
Partially correct |
68 ms |
7104 KB |
Partially correct |
7 |
Partially correct |
62 ms |
7096 KB |
Partially correct |
8 |
Partially correct |
65 ms |
7112 KB |
Partially correct |
9 |
Partially correct |
61 ms |
7096 KB |
Partially correct |
10 |
Correct |
22 ms |
7136 KB |
Output is correct |
11 |
Partially correct |
63 ms |
7096 KB |
Partially correct |
12 |
Correct |
72 ms |
7352 KB |
Output is correct |
13 |
Partially correct |
63 ms |
7148 KB |
Partially correct |
14 |
Partially correct |
56 ms |
7096 KB |
Partially correct |
15 |
Correct |
58 ms |
7148 KB |
Output is correct |
16 |
Correct |
17 ms |
6840 KB |
Output is correct |
17 |
Partially correct |
89 ms |
7420 KB |
Partially correct |
18 |
Partially correct |
90 ms |
7320 KB |
Partially correct |
19 |
Partially correct |
121 ms |
9000 KB |
Partially correct |
20 |
Partially correct |
89 ms |
8916 KB |
Partially correct |
21 |
Partially correct |
117 ms |
8984 KB |
Partially correct |
22 |
Partially correct |
162 ms |
9004 KB |
Partially correct |
23 |
Partially correct |
100 ms |
9044 KB |
Partially correct |
24 |
Partially correct |
153 ms |
9036 KB |
Partially correct |
25 |
Partially correct |
96 ms |
7440 KB |
Partially correct |
26 |
Partially correct |
124 ms |
7688 KB |
Partially correct |
27 |
Correct |
4 ms |
2320 KB |
Output is correct |
28 |
Partially correct |
51 ms |
7788 KB |
Partially correct |
29 |
Partially correct |
36 ms |
5736 KB |
Partially correct |
30 |
Correct |
54 ms |
7780 KB |
Output is correct |
31 |
Correct |
32 ms |
7856 KB |
Output is correct |
32 |
Partially correct |
60 ms |
7604 KB |
Partially correct |
33 |
Correct |
74 ms |
7400 KB |
Output is correct |
34 |
Partially correct |
68 ms |
8088 KB |
Partially correct |
35 |
Correct |
53 ms |
7836 KB |
Output is correct |
36 |
Partially correct |
59 ms |
7828 KB |
Partially correct |
37 |
Partially correct |
19 ms |
4904 KB |
Partially correct |
38 |
Partially correct |
47 ms |
5740 KB |
Partially correct |
39 |
Partially correct |
41 ms |
5900 KB |
Partially correct |
40 |
Correct |
11 ms |
5264 KB |
Output is correct |
41 |
Partially correct |
54 ms |
8424 KB |
Partially correct |
42 |
Partially correct |
40 ms |
8576 KB |
Partially correct |
43 |
Correct |
80 ms |
8972 KB |
Output is correct |
44 |
Correct |
20 ms |
8172 KB |
Output is correct |
45 |
Partially correct |
29 ms |
4908 KB |
Partially correct |
46 |
Partially correct |
37 ms |
5412 KB |
Partially correct |
47 |
Correct |
35 ms |
5256 KB |
Output is correct |
48 |
Correct |
2 ms |
2316 KB |
Output is correct |
49 |
Correct |
3 ms |
2324 KB |
Output is correct |
50 |
Partially correct |
18 ms |
7412 KB |
Partially correct |
51 |
Partially correct |
6 ms |
2992 KB |
Partially correct |
52 |
Partially correct |
4 ms |
2520 KB |
Partially correct |
53 |
Partially correct |
32 ms |
7680 KB |
Partially correct |
54 |
Partially correct |
19 ms |
6136 KB |
Partially correct |
55 |
Partially correct |
49 ms |
6832 KB |
Partially correct |
56 |
Partially correct |
38 ms |
8116 KB |
Partially correct |
57 |
Partially correct |
75 ms |
8696 KB |
Partially correct |
58 |
Partially correct |
54 ms |
6960 KB |
Partially correct |
59 |
Partially correct |
90 ms |
8792 KB |
Partially correct |
60 |
Partially correct |
67 ms |
8328 KB |
Partially correct |
61 |
Partially correct |
67 ms |
8696 KB |
Partially correct |
62 |
Partially correct |
69 ms |
8344 KB |
Partially correct |
63 |
Partially correct |
90 ms |
8768 KB |
Partially correct |
64 |
Correct |
18 ms |
7496 KB |
Output is correct |
65 |
Partially correct |
60 ms |
6816 KB |
Partially correct |
66 |
Partially correct |
36 ms |
9248 KB |
Partially correct |
67 |
Partially correct |
64 ms |
6788 KB |
Partially correct |
68 |
Partially correct |
43 ms |
9132 KB |
Partially correct |
69 |
Correct |
2 ms |
2316 KB |
Output is correct |
70 |
Correct |
2 ms |
2316 KB |
Output is correct |
71 |
Correct |
3 ms |
2320 KB |
Output is correct |
72 |
Partially correct |
20 ms |
4868 KB |
Partially correct |
73 |
Partially correct |
45 ms |
5304 KB |
Partially correct |
74 |
Partially correct |
49 ms |
5424 KB |
Partially correct |
75 |
Correct |
11 ms |
5128 KB |
Output is correct |
76 |
Correct |
2 ms |
2316 KB |
Output is correct |
77 |
Correct |
48 ms |
7904 KB |
Output is correct |
78 |
Partially correct |
45 ms |
7612 KB |
Partially correct |
79 |
Correct |
52 ms |
7604 KB |
Output is correct |
80 |
Correct |
2 ms |
2316 KB |
Output is correct |
81 |
Partially correct |
60 ms |
7276 KB |
Partially correct |
82 |
Partially correct |
50 ms |
7152 KB |
Partially correct |
83 |
Partially correct |
63 ms |
7180 KB |
Partially correct |