답안 #593880

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593880 2022-07-11T17:13:45 Z vladislav11 Newspapers (CEOI21_newspapers) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

int n, m;
vector< vector<int> > grp;

int main ()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m;

    grp.resize( n+1 );

    for ( int i=0; i<m; i++ )
    {
        int u, v;
        cin >> u >> v;

        grp[u].push_back( v );
        grp[v].push_back( u );
    }

    if ( m != n-1 )
    {
        cout << "NO\n";
        return 0;
    }

    for ( int i=1; i<=n; i++ )
    if ( grp[i].size() == n-1 )
    {
        cout << "YES\n2\n" << i << ' ' << i << '\n';
        return 0;
    }

    return 0;
}

Compilation message

newspapers.cpp: In function 'int main()':
newspapers.cpp:33:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |     if ( grp[i].size() == n-1 )
      |          ~~~~~~~~~~~~~~^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Unexpected end of file - token expected
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Unexpected end of file - token expected
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Unexpected end of file - token expected
4 Halted 0 ms 0 KB -