Submission #243603

#TimeUsernameProblemLanguageResultExecution timeMemory
243603osaaateiasavtnlMeetings (JOI19_meetings)C++14
29 / 100
3073 ms4484 KiB
#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;
bool par[N][N]; //is j parent of i
int sub[N];
int fath[N];
void Solve(int N) {
    int n = N;

    for (int i = 1; i < N; ++i)
        for (int j = i + 1; j < N; ++j) {
            int x = Query(0, i, j);
            if (x == i) 
                ++par[j][i];
            else if (x == j)    
                ++par[i][j];
        }   

    sub[0] = N;        
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            sub[i] += par[j][i];

    for (int i = 1; i < n; ++i) {
        fath[i] = 0;
        for (int j = 0; j < n; ++j) {
            if (par[i][j] && sub[j] < sub[fath[i]]) {
                fath[i] = j;
            }   
        }   

        int u = i, v = fath[i];
        if (v < u)
            swap(u, v);

        Bridge(u, v);
    }   
}

Compilation message (stderr)

meetings.cpp: In function 'void Solve(int)':
meetings.cpp:26:27: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
                 ++par[j][i];
                           ^
meetings.cpp:28:27: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
                 ++par[i][j];
                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...