Submission #265499

# Submission time Handle Problem Language Result Execution time Memory
265499 2020-08-14T22:26:20 Z doowey Airline Route Map (JOI18_airline) C++14
37 / 100
705 ms 30792 KB
#include <bits/stdc++.h>
#include "Alicelib.h"
#include <cassert>
#include <cstdio>

using namespace std;

typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

void Alice( int N, int M, int A[], int B[] ){
    vector<pii> edg;
    for(int i = 0; i < M ; i ++ ){
        edg.push_back(mp(A[i], B[i]));
    }
    for(int bit = 1; bit < 11; bit ++ ){
        edg.push_back(mp(N + bit - 1, N + bit));
    }
    edg.push_back(mp(N + 10, N + 7));
    for(int bit = 0; bit < 11; bit ++ ){
        for(int i = 0 ; i < N; i ++ ){
            if((i & (1 << bit))){
                edg.push_back(mp(N + bit, i));
            }
        }
    }
    for(int i = 0; i < N ; i ++ ){
        edg.push_back(mp(N + 11, i));
    }
    for(int i = 0 ; i < N + 11; i ++ ){
        edg.push_back(mp(i, N + 12));
    }
    InitG(N + 13, (int)edg.size());
    for(int i = 0 ; i < edg.size(); i ++ ){
        MakeG(i, edg[i].fi, edg[i].se);
    }

}
#include <bits/stdc++.h>
#include "Boblib.h"
#include <cassert>
#include <cstdio>

using namespace std;

typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

const int N = 1050;
vector<int> T[N];
bool hh[N];
bool gg[N];
bool vis[N];
int deg[N];
int idx[N];
bool out[N];

void Bob( int V, int U, int C[], int D[] ){
    int n = V - 13;
    int m = U;
    for(int i = 0 ; i < m; i ++ ){
        T[C[i]].push_back(D[i]);
        T[D[i]].push_back(C[i]);
    }
    int vso = -1;
    for(int i = 0 ; i < V; i ++ ){
        if(T[i].size() == n + 11){
            vso = i;
            hh[i]=true;
            for(auto x : T[i]){
                hh[x]=true;
            }
            break;
        }
    }
    int al = -1;
    for(int i = 0 ; i < V; i ++ ){
        if(!hh[i]){
            al = i;
        }
    }
    gg[vso]=true;
    for(auto x : T[al]){
        gg[x]=true;
    }
    vector<int> bits;
    for(int i = 0; i < V; i ++ ){
        if(!gg[i]){
            bits.push_back(i);
        }
    }
    for(auto x : bits){
        for(auto y : T[x]){
            if(!gg[y]){
                deg[x] ++ ;
            }
            else{
                out[x]=true;
            }
        }
    }
    vector<int> ord;
    int start = -1;
    for(auto x : bits){
        if(deg[x] == 1){
            start = x;
        }
    }
    bool went;
    for(int i = 0 ; i < bits.size(); i ++ ){
        vis[start] = true;
        ord.push_back(start);
        if(i + 1 == bits.size()) break;
        went = false;
        for(auto x : T[start]){
            if(gg[x] || vis[x]) continue;
            if(deg[x] == 2 || out[x]){
                start = x;
                went = true;
                break;
            }
        }
        if(!went){
            for(auto x : T[start]){
                if(gg[x] || vis[x] ) continue;
                start = x;
                break;
            }
        }
    }
    gg[vso] = false;
    for(int i = 0 ; i < ord.size(); i ++ ){
        for(auto x : T[ord[i]]){
            if(gg[x]){
                idx[x] += (1 << i);
            }
        }
    }
    vector<pii> sol;
    for(int i = 0 ; i < V; i ++ ){
        if(!gg[i]) continue;
        for(auto x : T[i]){
            if(!gg[x]) continue;
            if(idx[i] < idx[x])
                sol.push_back(mp(idx[i], idx[x]));
        }
    }
    InitMap(n, sol.size());
    for(auto x : sol)
        MakeMap(x.fi, x.se);
}

Compilation message

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i = 0 ; i < edg.size(); i ++ ){
      |                     ~~^~~~~~~~~~~~

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:32:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |         if(T[i].size() == n + 11){
      |            ~~~~~~~~~~~~^~~~~~~~~
Bob.cpp:75:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |     for(int i = 0 ; i < bits.size(); i ++ ){
      |                     ~~^~~~~~~~~~~~~
Bob.cpp:78:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |         if(i + 1 == bits.size()) break;
      |            ~~~~~~^~~~~~~~~~~~~~
Bob.cpp:97:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |     for(int i = 0 ; i < ord.size(); i ++ ){
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 6912 KB Output is correct
2 Correct 7 ms 6912 KB Output is correct
3 Correct 7 ms 6912 KB Output is correct
4 Correct 7 ms 6912 KB Output is correct
5 Correct 7 ms 6912 KB Output is correct
6 Correct 8 ms 6912 KB Output is correct
7 Correct 7 ms 6912 KB Output is correct
8 Correct 7 ms 6912 KB Output is correct
9 Correct 7 ms 6912 KB Output is correct
10 Correct 7 ms 6912 KB Output is correct
11 Correct 7 ms 6912 KB Output is correct
12 Correct 7 ms 6912 KB Output is correct
13 Correct 7 ms 6912 KB Output is correct
14 Correct 7 ms 6912 KB Output is correct
15 Correct 7 ms 6912 KB Output is correct
16 Correct 7 ms 6912 KB Output is correct
17 Correct 7 ms 6912 KB Output is correct
18 Correct 7 ms 7168 KB Output is correct
19 Correct 7 ms 6912 KB Output is correct
20 Correct 7 ms 6912 KB Output is correct
21 Correct 8 ms 6912 KB Output is correct
22 Correct 7 ms 6912 KB Output is correct
23 Correct 7 ms 6912 KB Output is correct
24 Correct 7 ms 6656 KB Output is correct
25 Correct 7 ms 6912 KB Output is correct
26 Correct 8 ms 6912 KB Output is correct
27 Correct 7 ms 6912 KB Output is correct
28 Correct 9 ms 6912 KB Output is correct
29 Correct 7 ms 6912 KB Output is correct
30 Correct 8 ms 6656 KB Output is correct
31 Correct 7 ms 6656 KB Output is correct
32 Correct 8 ms 6656 KB Output is correct
33 Correct 7 ms 6912 KB Output is correct
34 Correct 7 ms 6656 KB Output is correct
35 Correct 7 ms 6912 KB Output is correct
36 Correct 7 ms 6912 KB Output is correct
37 Correct 7 ms 6912 KB Output is correct
38 Correct 7 ms 6912 KB Output is correct
39 Correct 7 ms 6912 KB Output is correct
40 Correct 7 ms 6912 KB Output is correct
41 Correct 7 ms 6912 KB Output is correct
42 Correct 7 ms 6912 KB Output is correct
43 Correct 7 ms 6912 KB Output is correct
44 Correct 7 ms 6912 KB Output is correct
45 Correct 8 ms 6912 KB Output is correct
46 Correct 7 ms 6912 KB Output is correct
47 Correct 8 ms 6976 KB Output is correct
48 Correct 7 ms 6912 KB Output is correct
49 Correct 7 ms 6912 KB Output is correct
50 Correct 8 ms 6912 KB Output is correct
51 Correct 7 ms 6912 KB Output is correct
52 Correct 8 ms 6656 KB Output is correct
53 Correct 7 ms 6656 KB Output is correct
54 Correct 7 ms 6912 KB Output is correct
55 Correct 7 ms 6912 KB Output is correct
56 Correct 8 ms 6912 KB Output is correct
57 Correct 8 ms 6912 KB Output is correct
58 Correct 7 ms 6912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 6912 KB Output is correct
2 Correct 7 ms 6912 KB Output is correct
3 Correct 7 ms 6912 KB Output is correct
4 Correct 7 ms 6912 KB Output is correct
5 Correct 7 ms 6912 KB Output is correct
6 Correct 8 ms 6912 KB Output is correct
7 Correct 7 ms 6912 KB Output is correct
8 Correct 7 ms 6912 KB Output is correct
9 Correct 7 ms 6912 KB Output is correct
10 Correct 7 ms 6912 KB Output is correct
11 Correct 7 ms 6912 KB Output is correct
12 Correct 7 ms 6912 KB Output is correct
13 Correct 7 ms 6912 KB Output is correct
14 Correct 7 ms 6912 KB Output is correct
15 Correct 7 ms 6912 KB Output is correct
16 Correct 7 ms 6912 KB Output is correct
17 Correct 7 ms 6912 KB Output is correct
18 Correct 7 ms 7168 KB Output is correct
19 Correct 7 ms 6912 KB Output is correct
20 Correct 7 ms 6912 KB Output is correct
21 Correct 8 ms 6912 KB Output is correct
22 Correct 7 ms 6912 KB Output is correct
23 Correct 7 ms 6912 KB Output is correct
24 Correct 7 ms 6656 KB Output is correct
25 Correct 7 ms 6912 KB Output is correct
26 Correct 8 ms 6912 KB Output is correct
27 Correct 7 ms 6912 KB Output is correct
28 Correct 9 ms 6912 KB Output is correct
29 Correct 7 ms 6912 KB Output is correct
30 Correct 8 ms 6656 KB Output is correct
31 Correct 7 ms 6656 KB Output is correct
32 Correct 8 ms 6656 KB Output is correct
33 Correct 7 ms 6912 KB Output is correct
34 Correct 7 ms 6656 KB Output is correct
35 Correct 7 ms 6912 KB Output is correct
36 Correct 7 ms 6912 KB Output is correct
37 Correct 7 ms 6912 KB Output is correct
38 Correct 7 ms 6912 KB Output is correct
39 Correct 7 ms 6912 KB Output is correct
40 Correct 7 ms 6912 KB Output is correct
41 Correct 7 ms 6912 KB Output is correct
42 Correct 7 ms 6912 KB Output is correct
43 Correct 7 ms 6912 KB Output is correct
44 Correct 7 ms 6912 KB Output is correct
45 Correct 8 ms 6912 KB Output is correct
46 Correct 7 ms 6912 KB Output is correct
47 Correct 8 ms 6976 KB Output is correct
48 Correct 7 ms 6912 KB Output is correct
49 Correct 7 ms 6912 KB Output is correct
50 Correct 8 ms 6912 KB Output is correct
51 Correct 7 ms 6912 KB Output is correct
52 Correct 8 ms 6656 KB Output is correct
53 Correct 7 ms 6656 KB Output is correct
54 Correct 7 ms 6912 KB Output is correct
55 Correct 7 ms 6912 KB Output is correct
56 Correct 8 ms 6912 KB Output is correct
57 Correct 8 ms 6912 KB Output is correct
58 Correct 7 ms 6912 KB Output is correct
59 Correct 7 ms 6912 KB Output is correct
60 Correct 7 ms 6912 KB Output is correct
61 Correct 8 ms 6912 KB Output is correct
62 Correct 7 ms 6912 KB Output is correct
63 Correct 7 ms 6912 KB Output is correct
64 Correct 8 ms 6912 KB Output is correct
65 Correct 7 ms 6912 KB Output is correct
66 Correct 8 ms 6912 KB Output is correct
67 Correct 7 ms 6912 KB Output is correct
68 Correct 7 ms 6912 KB Output is correct
69 Correct 7 ms 6912 KB Output is correct
70 Correct 7 ms 6912 KB Output is correct
71 Correct 8 ms 6912 KB Output is correct
72 Correct 7 ms 6912 KB Output is correct
73 Correct 7 ms 6912 KB Output is correct
74 Correct 7 ms 6912 KB Output is correct
75 Correct 7 ms 6912 KB Output is correct
76 Correct 9 ms 6912 KB Output is correct
77 Correct 7 ms 6912 KB Output is correct
78 Correct 7 ms 6912 KB Output is correct
79 Correct 7 ms 6912 KB Output is correct
80 Correct 7 ms 6912 KB Output is correct
81 Correct 7 ms 6912 KB Output is correct
82 Correct 8 ms 6912 KB Output is correct
83 Correct 7 ms 6912 KB Output is correct
84 Correct 7 ms 6912 KB Output is correct
85 Correct 7 ms 6912 KB Output is correct
86 Correct 7 ms 6912 KB Output is correct
87 Correct 7 ms 6912 KB Output is correct
88 Correct 7 ms 6912 KB Output is correct
89 Correct 7 ms 6912 KB Output is correct
90 Correct 7 ms 6912 KB Output is correct
91 Correct 7 ms 6656 KB Output is correct
92 Correct 7 ms 6912 KB Output is correct
93 Correct 7 ms 6912 KB Output is correct
94 Correct 7 ms 7168 KB Output is correct
95 Correct 7 ms 6912 KB Output is correct
96 Correct 7 ms 6912 KB Output is correct
97 Correct 7 ms 6912 KB Output is correct
98 Correct 7 ms 6912 KB Output is correct
99 Correct 7 ms 6912 KB Output is correct
100 Correct 7 ms 6912 KB Output is correct
101 Correct 7 ms 6912 KB Output is correct
102 Correct 7 ms 6912 KB Output is correct
103 Correct 7 ms 6912 KB Output is correct
104 Correct 7 ms 6912 KB Output is correct
105 Correct 8 ms 6912 KB Output is correct
106 Correct 7 ms 6912 KB Output is correct
107 Correct 7 ms 6912 KB Output is correct
108 Correct 7 ms 6912 KB Output is correct
109 Correct 8 ms 6912 KB Output is correct
110 Correct 7 ms 6912 KB Output is correct
111 Correct 7 ms 6912 KB Output is correct
112 Correct 7 ms 6912 KB Output is correct
113 Correct 8 ms 6912 KB Output is correct
114 Correct 9 ms 6912 KB Output is correct
115 Correct 7 ms 6912 KB Output is correct
116 Correct 8 ms 6912 KB Output is correct
117 Correct 8 ms 6912 KB Output is correct
118 Correct 9 ms 6912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 705 ms 30792 KB Wrong Answer [120]
2 Halted 0 ms 0 KB -