Submission #561404

# Submission time Handle Problem Language Result Execution time Memory
561404 2022-05-12T18:55:49 Z Olympia Ronald (COCI17_ronald) C++17
0 / 120
3 ms 560 KB
#include <map>
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
bool okay (vector<vector<int>> &adj, int x, bool b) {
    int val[(int)adj.size()];
    for (int i = 0; i < (int)adj.size(); i++) {
        val[i] = adj[x][i] ^ b;
        cout << val[i] << ' ';
    }
    cout << '\n';
    for (int i = 0; i < adj.size(); i++) {
        for (int j = 0; j < adj.size(); j++) {
            if (adj[i][j] != (val[i] ^ val[j])) {
                return false;
            }
        }
    }
    return true;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<vector<int>> adj(n);
    for (int i = 0; i < n; i++) {
        adj[i].assign(n, 1);
        adj[i][i] = 0;
    }
    while (m--) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u][v] = adj[v][u] = 0;
    }
    if (okay(adj, 0, false) || okay(adj, 0, true)) {
        cout << "DA\n";
    } else {
        cout << "NE\n";
    }
}

Compilation message

ronald.cpp: In function 'bool okay(std::vector<std::vector<int> >&, int, bool)':
ronald.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (int i = 0; i < adj.size(); i++) {
      |                     ~~^~~~~~~~~~~~
ronald.cpp:15:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |         for (int j = 0; j < adj.size(); j++) {
      |                         ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 328 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -