답안 #47555

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
47555 2018-05-05T03:40:51 Z JohnTitor 호화 벙커 (IZhO13_burrow) C++11
0 / 100
12 ms 14456 KB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define setbit(s, i) (s|=(1LL<<(i)))
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "H"
int n, m;
int l[300001];
int r[300001];
int x[300001];
vector <int> a[300002];
vector <int> b[300002];
multiset <int> s;
int main(){
    #ifdef Kanikou
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Kanikou
    read(n);
    read(m);
    FOR(i, 1, m){
        read(l[i]);
        read(r[i]);
        read(x[i]);
        x[i]-=l[i];
        a[l[i]].pb(x[i]);
        b[r[i]+1].pb(x[i]);
    }
    FOR(i, 1, n){
        for(int x: a[i]) s.insert(x);
        for(int x: b[i]) s.erase(s.find(x));
        if(s.empty()) write(0);
        else write(*s.rbegin()+i);
        putchar(" \n"[i==n]);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 14456 KB Output isn't correct
2 Halted 0 ms 0 KB -