답안 #602795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
602795 2022-07-23T11:18:24 Z cadmiumsky Newspapers (CEOI21_newspapers) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {  
  int n, m;
  cin >> n >> m;
  if(m == n - 1) {
    cout << "YES\n1\n1\n";
  }
  else if(m == n) {
    for(int i = 0, x, y; i < m; i++) {
      cin >> x >> y;
      g[x].push_back(y);
      g[y].push_back(x);
    }
    for(int i = 1; i <= n; i++) {
      if(g[i].size() != 2) {
        cout << "NO\n";
        return 0;
      }
    }
    cout << "NO\n";
  }
  else
    cout << "YES\n1\n1\n";
}

Compilation message

newspapers.cpp: In function 'int main()':
newspapers.cpp:14:7: error: 'g' was not declared in this scope
   14 |       g[x].push_back(y);
      |       ^
newspapers.cpp:18:10: error: 'g' was not declared in this scope
   18 |       if(g[i].size() != 2) {
      |          ^