Submission #205216

# Submission time Handle Problem Language Result Execution time Memory
205216 2020-02-28T10:26:55 Z egekabas Meetings (JOI19_meetings) C++14
0 / 100
6 ms 508 KB
#include <bits/stdc++.h>
#include "meetings.h"
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<int, int>  pii;
typedef pair<ld, ld>  pld;
int p[2009];
void calc(int root, vector<int> all){
    if(all.size() <= 1) return;
    vector<vector<int>> vec;
    vector<int> lead;
    for(auto u : all){
        if(u == root) continue;
        int put = 0;
        for(int i = 0; i < lead.size(); ++i){
            if(lead[i] == u){
                vec[i].pb(u);
                put = 1;
                break;
            }
            int tmp = Query(u, lead[i], root);
            if(tmp == root) continue;
            lead[i] = tmp;
            vec[i].pb(u);
            put = 1;
            break;
        }
    }
    for(int i = 0; i < lead.size(); ++i){
        p[lead[i]] = root;
        calc(lead[i], vec[i]);
    }
        
}

void Solve(int n){
    vector<int> all;
    for(int i = 0; i < n; ++i)
        all.pb(i);
    calc(0, all);
    for(int i = 1; i < n; ++i)
        Bridge(min(i, p[i]), max(i, p[i]));
}

Compilation message

meetings.cpp: In function 'void calc(int, std::vector<int>)':
meetings.cpp:23:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0; i < lead.size(); ++i){
                        ~~^~~~~~~~~~~~~
meetings.cpp:22:13: warning: variable 'put' set but not used [-Wunused-but-set-variable]
         int put = 0;
             ^~~
meetings.cpp:37:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < lead.size(); ++i){
                    ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Wrong Answer [4]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Wrong Answer [4]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Wrong Answer [4]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 508 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -