답안 #222363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222363 2020-04-13T05:23:25 Z dantoh000 Checker (COCI19_checker) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int col[200005];
int adjlist[200005];
int main(){
    int st;
    scanf("%d",&st);
    int n;
    scanf("%d",&n);
    for (int i = 0; i < n; i++){
        scanf("%d",&col[i]);
    }
    for (int i = 0; i < n-3; i++){
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        adjlist[a].push_back({b,c});
        adjlist[b].push_back({a,c});
    }
    int ct=  0;
    for (int i = 0; i < n; i++){
        if ((int)adjlist[i].size() % 2 == 1){
            ct++;
        }
    }
    if (st == 3){
        printf("%s",ct>2?"neispravna triangulacija":"tocno");
    }
}

Compilation message

checker.cpp: In function 'int main()':
checker.cpp:16:20: error: request for member 'push_back' in 'adjlist[a]', which is of non-class type 'int'
         adjlist[a].push_back({b,c});
                    ^~~~~~~~~
checker.cpp:17:20: error: request for member 'push_back' in 'adjlist[b]', which is of non-class type 'int'
         adjlist[b].push_back({a,c});
                    ^~~~~~~~~
checker.cpp:21:29: error: request for member 'size' in 'adjlist[i]', which is of non-class type 'int'
         if ((int)adjlist[i].size() % 2 == 1){
                             ^~~~
checker.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&st);
     ~~~~~^~~~~~~~~~
checker.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
checker.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&col[i]);
         ~~~~~^~~~~~~~~~~~~~
checker.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d",&a,&b,&c);
         ~~~~~^~~~~~~~~~~~~~~~~~~