Submission #575016

#TimeUsernameProblemLanguageResultExecution timeMemory
575016AJ00Connecting Supertrees (IOI20_supertrees)C++14
11 / 100
169 ms23932 KiB
#include <bits/stdc++.h>
#include "supertrees.h"
using namespace std;

int n;
const int MOD = 1000000007;
const int INF = 1e18;

int construct(vector<vector<int>> p){
    int n = p[0].size();
    vector<vector<int>> b;
    b.resize(n);
    for (int i = 0; i < n; i++){
        b[i].resize(n);
        for (int j = 0; j < n; j++){
            b[i][j] = 0;
        }
    }
    if (n == 1){
        build(b);
        return 1;
    }
    for (int i = 0; i < n; i++){
        if (i == 0){
            b[0][1] = 1;
        }
        else if (i == n-1){
            b[n-1][n-2] = 1;
        }
        else {
            b[i][i-1] = 1;
            b[i][i+1] = 1;
        }
    }
  /*  for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            
        }
    }*/
    build(b);
    return 1;
}

Compilation message (stderr)

supertrees.cpp:7:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    7 | const int INF = 1e18;
      |                 ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...