Submission #593883

# Submission time Handle Problem Language Result Execution time Memory
593883 2022-07-11T17:14:49 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;
    }

    cout << "NO\n";

    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 )
      |          ~~~~~~~~~~~~~~^~~~~~
# Verdict Execution time Memory 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 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -