Submission #493273

# Submission time Handle Problem Language Result Execution time Memory
493273 2021-12-10T16:01:50 Z Itamar Restore Array (RMI19_restore) C++14
13 / 100
23 ms 588 KB
// binary A.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
#include <vector>
int main()
{
    int n, m;
    cin >> n >> m;
    vector<bool> vec(n);
    vector<pair<int, int>> req;
    for (int i = 0; i < m; i++) {
        int k, l, val, r;
        cin >> l >> r >> k >> val;
        if (val == 1) {
            for (int j = l; j <= r; j++) {
                vec[j] = 1;
            }
        }
        else {
            req.push_back({ l,r });
        }
    }
    for (int i = 0; i < req.size(); i++) {
        for (int j = req[i].first; j <= req[i].second; j++) {
            if (vec[j] == 0) {
                break;
            }
            if (j == req[i].second) {
                cout << -1; 
                return 0;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        cout << vec[i] << ' ';
    }
}

Compilation message

restore.cpp: In function 'int main()':
restore.cpp:25:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (int i = 0; i < req.size(); i++) {
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 532 KB Output is correct
2 Correct 8 ms 532 KB Output is correct
3 Correct 8 ms 588 KB Output is correct
4 Correct 11 ms 524 KB Output is correct
5 Correct 18 ms 460 KB Output is correct
6 Correct 16 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 532 KB Output is correct
2 Correct 8 ms 532 KB Output is correct
3 Correct 8 ms 588 KB Output is correct
4 Correct 11 ms 524 KB Output is correct
5 Correct 18 ms 460 KB Output is correct
6 Correct 16 ms 460 KB Output is correct
7 Incorrect 23 ms 484 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -