Submission #243622

# Submission time Handle Problem Language Result Execution time Memory
243622 2020-07-01T12:34:10 Z osaaateiasavtnl Meetings (JOI19_meetings) C++14
29 / 100
2000 ms 512 KB
#include "meetings.h"
#include<bits/stdc++.h>
using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';

const int N = 2007;

int par[N];
int link[N];
void Solve(int n) {
    
    for (int i = 1; i < n; ++i)
        par[i] = -1;
          
    queue <int> q;
    q.push(0);
    while (q.size()) {
        int u = q.front(); q.pop();

        vector <int> cur;                                
        for (int v = 0; v < n; ++v) {
            if (par[v] == -1 && link[u] == link[v]) {
                vector <bool> del(cur.size());
                bool ban = 0;
                for (int i = 0; i < cur.size(); ++i) {
                    int x = Query(0, v, cur[i]);
                    if (x == v) {
                        del[i] = 1;
                        link[cur[i]] = v;
                        continue;
                    }   
                    if (x == cur[i]) {
                        link[v] = cur[i];
                        ban = 1;
                        break;
                    }
                }   
                if (!ban) {
                    vector <int> a = {v};                    
                    link[v] = v;
                    for (int i = 0; i < cur.size(); ++i) {
                        if (!del[i])
                            a.app(cur[i]);
                    }
                    cur = a;
                }
            }
        }

        for (int i = 0; i < n; ++i)
            while (link[link[i]] != link[i])
                link[i] = link[link[i]];

        /*            
        cout << "link : ";
        for (int i = 0; i < n; ++i)
            cout << link[i] << ' ';
        cout << endl;
        */

        for (int v : cur) {
            par[v] = u;            
            q.push(v);
        }   
    }   

    for (int i = 1; i < n; ++i) {
        int u = i;
        int v = par[i];
        if (v < u)
            swap(u, v);

        #ifdef HOME
        cout << "edge " << u << ' ' << v << endl;
        #endif

        Bridge(u,v);
    }   
}

Compilation message

meetings.cpp: In function 'void Solve(int)':
meetings.cpp:34:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for (int i = 0; i < cur.size(); ++i) {
                                 ~~^~~~~~~~~~~~
meetings.cpp:50:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     for (int i = 0; i < cur.size(); ++i) {
                                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 6 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 6 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 6 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 6 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 85 ms 384 KB Output is correct
28 Correct 56 ms 384 KB Output is correct
29 Correct 53 ms 504 KB Output is correct
30 Correct 77 ms 384 KB Output is correct
31 Correct 41 ms 512 KB Output is correct
32 Correct 100 ms 452 KB Output is correct
33 Correct 78 ms 504 KB Output is correct
34 Correct 114 ms 460 KB Output is correct
35 Correct 85 ms 504 KB Output is correct
36 Correct 44 ms 504 KB Output is correct
37 Correct 97 ms 504 KB Output is correct
38 Correct 160 ms 480 KB Output is correct
39 Correct 231 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3081 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -