Submission #1081399

# Submission time Handle Problem Language Result Execution time Memory
1081399 2024-08-30T04:04:06 Z veehj The Ties That Guide Us (CEOI23_incursion) C++17
9 / 100
247 ms 7508 KB
#include "incursion.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()

vector<int> mark(vector<pair<int, int>> f, int safe) {
  vector<vector<int>> adj(f.size()+1, vector<int>(0));
  vector<int> ans(f.size()+1, -1);
  for(auto& u : f){
      u.F--; u.S--;
      adj[u.F].pb(u.S);
      adj[u.S].pb(u.F);
  }
  ans.assign(f.size()+1, -1);
  safe--;
  priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
  q.push({0, safe});
  ans[safe]=0;
  while(!q.empty()){
    int nw=q.top().S;
    if(ans[nw]<q.top().F){
      q.pop();
      continue;
    }
    q.pop();
    for(auto& u : adj[nw]){
      if(ans[u]==-1 || ans[u]>ans[nw]+1){
        ans[u]=ans[nw]+1;
        q.push({ans[u], u});
      }
    }
  }
  return ans;
}

void locate(vector<pair<int, int>> f, int curr, int t) {
  vector<vector<int>> adj(f.size()+1, vector<int>(0));
  vector<bool> vist(f.size()+1, 0);
  for(auto& u : f){
      u.F--; u.S--;
      adj[u.F].pb(u.S);
      adj[u.S].pb(u.F);
  }
  curr--;
  int lst=curr, lstdeg=t;
  while(t!=0){
    vist[curr]=1;
    if(t>lstdeg){
      for(auto& u : adj[curr]){
        vist[u]=1;
      }
      t=visit(lst+1);
      curr=lst;
      continue;
    }
    for(auto& u : adj[curr]){
      if(vist[u]) continue;
      lst=curr;
      lstdeg=t;
      t=visit(u+1);
      curr=u;
      break;
    }
  }
  return;
}

Compilation message

interface.cpp: In function 'int main()':
interface.cpp:44:55: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |     if(fread(T.data(), sizeof(int), 2 * N - 2, stdin) != 2 * N - 2) exit(0);
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
interface.cpp:50:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |         int l = (numbers.size() == N ? N : 0);
      |                  ~~~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 1016 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 194 ms 7188 KB Partially correct
2 Partially correct 183 ms 7276 KB Partially correct
3 Partially correct 115 ms 7068 KB Partially correct
4 Partially correct 107 ms 7408 KB Partially correct
5 Partially correct 182 ms 7200 KB Partially correct
6 Partially correct 77 ms 6984 KB Partially correct
7 Partially correct 78 ms 6940 KB Partially correct
8 Partially correct 213 ms 7208 KB Partially correct
9 Partially correct 230 ms 7204 KB Partially correct
10 Partially correct 143 ms 7272 KB Partially correct
11 Partially correct 87 ms 7068 KB Partially correct
12 Partially correct 243 ms 7200 KB Partially correct
13 Partially correct 88 ms 7072 KB Partially correct
14 Partially correct 71 ms 7176 KB Partially correct
15 Partially correct 207 ms 7324 KB Partially correct
16 Partially correct 205 ms 7272 KB Partially correct
17 Partially correct 128 ms 7200 KB Partially correct
18 Partially correct 86 ms 7080 KB Partially correct
19 Partially correct 164 ms 7264 KB Partially correct
20 Partially correct 84 ms 7404 KB Partially correct
21 Partially correct 72 ms 7068 KB Partially correct
22 Partially correct 185 ms 7324 KB Partially correct
23 Partially correct 200 ms 7372 KB Partially correct
24 Partially correct 105 ms 7268 KB Partially correct
25 Partially correct 81 ms 7252 KB Partially correct
26 Partially correct 80 ms 7324 KB Partially correct
27 Partially correct 73 ms 6984 KB Partially correct
28 Partially correct 76 ms 7164 KB Partially correct
29 Partially correct 204 ms 7272 KB Partially correct
30 Partially correct 197 ms 7324 KB Partially correct
31 Partially correct 78 ms 7260 KB Partially correct
32 Partially correct 222 ms 7508 KB Partially correct
33 Partially correct 244 ms 7208 KB Partially correct
34 Partially correct 81 ms 7072 KB Partially correct
35 Partially correct 81 ms 7376 KB Partially correct
36 Partially correct 193 ms 7268 KB Partially correct
37 Partially correct 219 ms 7264 KB Partially correct
38 Partially correct 247 ms 7260 KB Partially correct
39 Partially correct 136 ms 7268 KB Partially correct
40 Partially correct 197 ms 7424 KB Partially correct
41 Partially correct 77 ms 7004 KB Partially correct
42 Partially correct 76 ms 7076 KB Partially correct
43 Partially correct 210 ms 7264 KB Partially correct
44 Partially correct 208 ms 7204 KB Partially correct
45 Partially correct 81 ms 7272 KB Partially correct
46 Partially correct 69 ms 6992 KB Partially correct
47 Partially correct 94 ms 7068 KB Partially correct
48 Partially correct 74 ms 7260 KB Partially correct
49 Partially correct 75 ms 7004 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 77 ms 7004 KB Partially correct
2 Incorrect 86 ms 7068 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 1016 KB Partially correct
2 Partially correct 194 ms 7188 KB Partially correct
3 Partially correct 183 ms 7276 KB Partially correct
4 Partially correct 115 ms 7068 KB Partially correct
5 Partially correct 107 ms 7408 KB Partially correct
6 Partially correct 182 ms 7200 KB Partially correct
7 Partially correct 77 ms 6984 KB Partially correct
8 Partially correct 78 ms 6940 KB Partially correct
9 Partially correct 213 ms 7208 KB Partially correct
10 Partially correct 230 ms 7204 KB Partially correct
11 Partially correct 143 ms 7272 KB Partially correct
12 Partially correct 87 ms 7068 KB Partially correct
13 Partially correct 243 ms 7200 KB Partially correct
14 Partially correct 88 ms 7072 KB Partially correct
15 Partially correct 71 ms 7176 KB Partially correct
16 Partially correct 207 ms 7324 KB Partially correct
17 Partially correct 205 ms 7272 KB Partially correct
18 Partially correct 128 ms 7200 KB Partially correct
19 Partially correct 86 ms 7080 KB Partially correct
20 Partially correct 164 ms 7264 KB Partially correct
21 Partially correct 84 ms 7404 KB Partially correct
22 Partially correct 72 ms 7068 KB Partially correct
23 Partially correct 185 ms 7324 KB Partially correct
24 Partially correct 200 ms 7372 KB Partially correct
25 Partially correct 105 ms 7268 KB Partially correct
26 Partially correct 81 ms 7252 KB Partially correct
27 Partially correct 80 ms 7324 KB Partially correct
28 Partially correct 73 ms 6984 KB Partially correct
29 Partially correct 76 ms 7164 KB Partially correct
30 Partially correct 204 ms 7272 KB Partially correct
31 Partially correct 197 ms 7324 KB Partially correct
32 Partially correct 78 ms 7260 KB Partially correct
33 Partially correct 222 ms 7508 KB Partially correct
34 Partially correct 244 ms 7208 KB Partially correct
35 Partially correct 81 ms 7072 KB Partially correct
36 Partially correct 81 ms 7376 KB Partially correct
37 Partially correct 193 ms 7268 KB Partially correct
38 Partially correct 219 ms 7264 KB Partially correct
39 Partially correct 247 ms 7260 KB Partially correct
40 Partially correct 136 ms 7268 KB Partially correct
41 Partially correct 197 ms 7424 KB Partially correct
42 Partially correct 77 ms 7004 KB Partially correct
43 Partially correct 76 ms 7076 KB Partially correct
44 Partially correct 210 ms 7264 KB Partially correct
45 Partially correct 208 ms 7204 KB Partially correct
46 Partially correct 81 ms 7272 KB Partially correct
47 Partially correct 69 ms 6992 KB Partially correct
48 Partially correct 94 ms 7068 KB Partially correct
49 Partially correct 74 ms 7260 KB Partially correct
50 Partially correct 75 ms 7004 KB Partially correct
51 Partially correct 77 ms 7004 KB Partially correct
52 Incorrect 86 ms 7068 KB Not correct
53 Halted 0 ms 0 KB -