답안 #865113

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865113 2023-10-24T05:39:14 Z vjudge1 Meteors (POI11_met) C++17
74 / 100
4548 ms 3692 KB
//Bismillahir-Rahmanir-Rahim
#include <bits/stdc++.h>
         
using namespace std;
      
#define flash ios_base::sync_with_stdio(0),cin.tie(0)
#define pb push_back
#define ll long long
#define ld long double
#define dbg(x) cerr << #x << " = " << x << "\n";
#define ff first
#define ss second
 
 /*     
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma comment (linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/ 
 
const long long INF = 1e9 + 7;
const long long MOD = 1e9 + 7;
const int maxn = 1e5 + 10;

int n, m, k, p[maxn], o[maxn], ans[maxn], met[maxn];

void press_F_() {
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		cin >> o[i];
	}
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	cin >> k;
	int id = 1;
	while(k--) {
		int l, r, a;
		cin >> l >> r >> a;
		if (l <= r) {
			for (int i = l; i <= r; i++) {
				met[o[i]] += a;
			}
		} else {
			for (int i = l; i <= m; i++) {
				met[o[i]] += a;
			}
			for (int i = 1; i <= r; i++) {
				met[o[i]] += a;
			}
		}
		for (int i = 1; i <= n; i++) {
			if (met[i] >= p[i] && ans[i] == 0) {
				ans[i] = id;
			}
		}
		id++;
	}
	for (int i = 1; i <= n; i++) {
		if (ans[i] == 0) {
			cout << "NIE" << '\n';
		} else {
			cout << ans[i] << '\n';
		}
	}
} 

int main() {
    flash;
    // srand(time(0));
    int T = 1;
    // cin >> T;
    for (int i = 1; i <= T; i++) {
        // cout << "Case" << " " << i << ':' << "\n";
        press_F_();
    }
    //Respa gold 2023-2024 InshAllah
    return 0;
}
/*
Maybe not today and tomorrow, but InshAllah one day I will reach expert
*/
// g++ -std=c++17 main.cpp
// ./a.out
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1439 ms 852 KB Output is correct
2 Correct 2163 ms 1116 KB Output is correct
3 Correct 1857 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1200 ms 752 KB Output is correct
2 Correct 1217 ms 756 KB Output is correct
3 Correct 3214 ms 940 KB Output is correct
4 Correct 84 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1012 ms 872 KB Output is correct
2 Correct 3597 ms 1116 KB Output is correct
3 Correct 33 ms 348 KB Output is correct
4 Correct 2942 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2036 ms 652 KB Output is correct
2 Correct 3155 ms 768 KB Output is correct
3 Correct 817 ms 664 KB Output is correct
4 Correct 4548 ms 940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 29 ms 3668 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1728 ms 3692 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -