답안 #496224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496224 2021-12-21T03:25:52 Z kingline Meteors (POI11_met) C++17
74 / 100
6000 ms 3316 KB
/*#pragma GCC optimize("O3")
#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")*/
#include <bits/stdc++.h>
#define file(data) freopen(data".in", "r", stdin); freopen(data".out", "w", stdout);
#define pb push_back
#define all(data) data.begin(), data.end()
#define endl '\n'
#define ll long long
#define int long long
#define pii pair < int, int >

using namespace std;

const int N = 3e5 + 5;
const int INF = 1e9;

int n, m, o[N], p[N], ans[N], num;

void change(int l, int r, int x) {
    for(int i = l; i <= r; i++) {
        if(p[o[i]] > 0) {
            p[o[i]] -= x;
            if(p[o[i]] <= 0) {
                ans[o[i]] = num;
            }
        }
    }
}

main() {
    //file("pieaters");
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        cin >> o[i];
    }
    for(int i = 1; i <= n; i++) {
        cin >> p[i];
    }
    int q;
    cin >> q;
    while(q--) {
        int l, r, x;
        num++;
        cin >> l >> r >> x;
        if(l <= r) {
            change(l, r, x);
        } else {
            change(l, m, x);
            change(1, r, x);
        }
    }
    for(int i = 1; i <= n; i++) {
        if(ans[i] == 0) cout << "NIE\n";
        else cout << ans[i] << endl;
    }
}






Compilation message

met.cpp:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   33 | main() {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 484 ms 740 KB Output is correct
2 Correct 5822 ms 2236 KB Output is correct
3 Correct 2945 ms 1964 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1644 ms 848 KB Output is correct
2 Correct 2210 ms 1948 KB Output is correct
3 Correct 1852 ms 2356 KB Output is correct
4 Correct 10 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2129 ms 780 KB Output is correct
2 Correct 4616 ms 2288 KB Output is correct
3 Correct 32 ms 840 KB Output is correct
4 Correct 2316 ms 2104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2528 ms 716 KB Output is correct
2 Correct 4174 ms 852 KB Output is correct
3 Correct 1436 ms 716 KB Output is correct
4 Correct 5095 ms 2440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6080 ms 3316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6090 ms 3260 KB Time limit exceeded
2 Halted 0 ms 0 KB -