Submission #642921

#TimeUsernameProblemLanguageResultExecution timeMemory
642921n3rm1nRestore Array (RMI19_restore)C++17
0 / 100
3 ms596 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; const int MAXN = 5005; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n, m; int a[MAXN]; vector < pair < int, int > > v; int p[MAXN]; void read() { cin >> n >> m; int l, r, k, val; for (int i = 1; i <= m; ++ i) { cin >> l >> r >> k >> val; if(k == 1 && val == 1) { for (int j = l; j <= r; ++ j) a[j] = 1; } else if(k == 1 && val == 0) { v.push_back(make_pair(l, r)); } } for (int i = 1; i <= n; ++ i) { p[i] = p[i-1] + a[i]; } bool ok = true; for (int i = 0; i < v.size() && false; ++ i) { int l = v[i].first, r = v[i].second; if(p[r] - p[l-1] == r - l + 1)ok = false; } if(!ok)cout << -1 << endl; else { for (int i = 1; i <= n; ++ i) cout << a[i] << " "; cout << endl; } } int main() { speed(); read(); return 0; }

Compilation message (stderr)

restore.cpp: In function 'void read()':
restore.cpp:38: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]
   38 |     for (int i = 0; i < v.size() && false; ++ i)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...