Submission #1107689

# Submission time Handle Problem Language Result Execution time Memory
1107689 2024-11-02T01:36:09 Z ozner77 Parachute rings (IOI12_rings) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> V;
vector<long long> sumas;
int init(long long N){
    vector<long long> V1(N,0);
    for(int i=0;i<N;i++){
        V.push_back(V1);
    }
}
int Link(long long A,long long B){
    V[A][B]=1;
    V[B][A]=1;
    sumas[A]++;
    sumas[B]++;
}
int CountCritical(){
    long long critical=0;
    for(int i=0;i<V.size();i++){
        bool es=true;
        for(int j=0;j<V.size();j++){
            if(i!=j){
                if(V[j][i]==1){
                    if(sumas[j]-1>2){
                        es=false;
                        break;
                    }
                }else{
                    if(sumas[j]>2){
                        es=false;
                        break;
                    }
                }
            }
        }
        if(es){
            critical++;
        }
    }
    return critical;
}

Compilation message

rings.cpp: In function 'int init(long long int)':
rings.cpp:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
rings.cpp: In function 'int Link(long long int, long long int)':
rings.cpp:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
   16 | }
      | ^
rings.cpp: In function 'int CountCritical()':
rings.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0;i<V.size();i++){
      |                 ~^~~~~~~~~
rings.cpp:21:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int j=0;j<V.size();j++){
      |                     ~^~~~~~~~~
/usr/bin/ld: /tmp/ccDY0fry.o: in function `main':
grader.cpp:(.text.startup+0x88): undefined reference to `Init(int)'
/usr/bin/ld: grader.cpp:(.text.startup+0xca): undefined reference to `Link(int, int)'
collect2: error: ld returned 1 exit status