제출 #548171

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
5481712022-04-12 15:53:05CommandMasterRestore Array (RMI19_restore)C++17
100 / 100
347 ms936 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll,ll>
int main() {
ll n, m;
cin >> n >> m;
vector<vector<pll>> graph(n+1);
for (ll i = 0; i < n; i++) graph[i].push_back({i+1, 1}), graph[i+1].push_back({i, 0});
for (ll i = 0; i < m; i++) {
ll l, r, k, v;
cin >> l >> r >> k >> v;
k--;
if (v == 1) {
// cout << l << ' ' << r+1 << ' ' << -((r-l+1)-k) << endl;
graph[r+1].push_back({l, k-(r-l+1)});
} else {
// cout << r+1 << ' ' << l << ' ' << (r-l+1)-k-1 << endl;
graph[l].push_back({r+1, (r-l+1)-k-1});
}
}
vll dist(n+1, 1e9);
dist[0] = 0;
bool changed = true;
for (ll i = 0; i < 2500; i++) {
// for (ll j = 0; j < n+1; j++) cout << dist[j] << ' ';
// cout << endl;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...