# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1051080 |
2024-08-09T19:21:46 Z |
beaconmc |
Spy 3 (JOI24_spy3) |
C++17 |
|
148 ms |
8108 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<array<ll,3>> 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 |
26 ms |
6440 KB |
Partially correct |
2 |
Correct |
2 ms |
2324 KB |
Output is correct |
3 |
Partially correct |
57 ms |
6164 KB |
Partially correct |
4 |
Partially correct |
56 ms |
6328 KB |
Partially correct |
5 |
Partially correct |
65 ms |
5900 KB |
Partially correct |
6 |
Partially correct |
66 ms |
5976 KB |
Partially correct |
7 |
Partially correct |
57 ms |
6004 KB |
Partially correct |
8 |
Partially correct |
61 ms |
5816 KB |
Partially correct |
9 |
Partially correct |
53 ms |
6268 KB |
Partially correct |
10 |
Correct |
19 ms |
5980 KB |
Output is correct |
11 |
Partially correct |
59 ms |
5816 KB |
Partially correct |
12 |
Correct |
68 ms |
5816 KB |
Output is correct |
13 |
Partially correct |
59 ms |
6064 KB |
Partially correct |
14 |
Partially correct |
50 ms |
6016 KB |
Partially correct |
15 |
Correct |
60 ms |
6164 KB |
Output is correct |
16 |
Correct |
14 ms |
5908 KB |
Output is correct |
17 |
Partially correct |
78 ms |
6620 KB |
Partially correct |
18 |
Partially correct |
80 ms |
6732 KB |
Partially correct |
19 |
Partially correct |
111 ms |
7784 KB |
Partially correct |
20 |
Partially correct |
80 ms |
7656 KB |
Partially correct |
21 |
Partially correct |
109 ms |
7852 KB |
Partially correct |
22 |
Partially correct |
147 ms |
7724 KB |
Partially correct |
23 |
Partially correct |
95 ms |
7760 KB |
Partially correct |
24 |
Partially correct |
148 ms |
7768 KB |
Partially correct |
25 |
Partially correct |
88 ms |
6648 KB |
Partially correct |
26 |
Partially correct |
92 ms |
6740 KB |
Partially correct |
27 |
Correct |
4 ms |
2316 KB |
Output is correct |
28 |
Partially correct |
49 ms |
6528 KB |
Partially correct |
29 |
Partially correct |
34 ms |
4976 KB |
Partially correct |
30 |
Correct |
52 ms |
6328 KB |
Output is correct |
31 |
Correct |
33 ms |
6328 KB |
Output is correct |
32 |
Partially correct |
56 ms |
6372 KB |
Partially correct |
33 |
Correct |
60 ms |
6204 KB |
Output is correct |
34 |
Partially correct |
57 ms |
6868 KB |
Partially correct |
35 |
Correct |
43 ms |
6832 KB |
Output is correct |
36 |
Partially correct |
56 ms |
6708 KB |
Partially correct |
37 |
Partially correct |
16 ms |
4364 KB |
Partially correct |
38 |
Partially correct |
37 ms |
5272 KB |
Partially correct |
39 |
Partially correct |
37 ms |
5044 KB |
Partially correct |
40 |
Correct |
8 ms |
4596 KB |
Output is correct |
41 |
Partially correct |
44 ms |
7136 KB |
Partially correct |
42 |
Partially correct |
34 ms |
7472 KB |
Partially correct |
43 |
Correct |
70 ms |
7716 KB |
Output is correct |
44 |
Correct |
16 ms |
6936 KB |
Output is correct |
45 |
Partially correct |
22 ms |
4332 KB |
Partially correct |
46 |
Partially correct |
30 ms |
4848 KB |
Partially correct |
47 |
Correct |
28 ms |
4872 KB |
Output is correct |
48 |
Correct |
2 ms |
2320 KB |
Output is correct |
49 |
Correct |
3 ms |
2316 KB |
Output is correct |
50 |
Partially correct |
15 ms |
6408 KB |
Partially correct |
51 |
Partially correct |
5 ms |
2832 KB |
Partially correct |
52 |
Partially correct |
4 ms |
2324 KB |
Partially correct |
53 |
Partially correct |
27 ms |
6428 KB |
Partially correct |
54 |
Partially correct |
16 ms |
5056 KB |
Partially correct |
55 |
Partially correct |
39 ms |
5904 KB |
Partially correct |
56 |
Partially correct |
33 ms |
7044 KB |
Partially correct |
57 |
Partially correct |
59 ms |
7496 KB |
Partially correct |
58 |
Partially correct |
53 ms |
5896 KB |
Partially correct |
59 |
Partially correct |
84 ms |
7488 KB |
Partially correct |
60 |
Partially correct |
62 ms |
7120 KB |
Partially correct |
61 |
Partially correct |
65 ms |
7360 KB |
Partially correct |
62 |
Partially correct |
64 ms |
7056 KB |
Partially correct |
63 |
Partially correct |
79 ms |
7468 KB |
Partially correct |
64 |
Correct |
16 ms |
6444 KB |
Output is correct |
65 |
Partially correct |
57 ms |
6092 KB |
Partially correct |
66 |
Partially correct |
33 ms |
8108 KB |
Partially correct |
67 |
Partially correct |
61 ms |
6072 KB |
Partially correct |
68 |
Partially correct |
39 ms |
8024 KB |
Partially correct |
69 |
Correct |
1 ms |
2320 KB |
Output is correct |
70 |
Correct |
2 ms |
2316 KB |
Output is correct |
71 |
Correct |
3 ms |
2316 KB |
Output is correct |
72 |
Partially correct |
18 ms |
4288 KB |
Partially correct |
73 |
Partially correct |
39 ms |
4860 KB |
Partially correct |
74 |
Partially correct |
47 ms |
4864 KB |
Partially correct |
75 |
Correct |
10 ms |
4568 KB |
Output is correct |
76 |
Correct |
2 ms |
2312 KB |
Output is correct |
77 |
Correct |
44 ms |
6404 KB |
Output is correct |
78 |
Partially correct |
38 ms |
6552 KB |
Partially correct |
79 |
Correct |
48 ms |
6648 KB |
Output is correct |
80 |
Correct |
2 ms |
2324 KB |
Output is correct |
81 |
Partially correct |
53 ms |
6000 KB |
Partially correct |
82 |
Partially correct |
48 ms |
5992 KB |
Partially correct |
83 |
Partially correct |
62 ms |
6072 KB |
Partially correct |