답안 #496358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496358 2021-12-21T06:19:24 Z vinnipuh01 Meteors (POI11_met) C++17
74 / 100
6000 ms 1856 KB
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>

using namespace std;

const long long oo = 1000000000000000000;

long long int  sum, ans = 0, mx = 0, mn = 1000000000, num, pos;


/*
    ViHHiPuh

   (( `'-""``""-'` ))
     )-__-_.._-__-(
   / --- (o _ o) --- \
   \ .-* ( .0. ) *-. /
   _'-. ,_ '=' _, .-'_
  / `;#'#'# - #'#'#;` \
 \_)) -----'#'----- ((_/
      # --------- #
  '# ------- ------ #'
  /..-'# ------- #'-.\
  _\...-\'# -- #'/-.../_
  ((____)- '#' -(____))


    cout << fixed << setprecision(6) << x;


    freopen ( "sum.in", "r", stdin )
*/

int mp[ 300001 ];

int main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	int a[ m + 1 ];
	for ( int i = 1; i <= m; i ++ )
		cin >> a[ i ];
	int b[ n + 1 ];
	for ( int i = 1; i <= n; i ++ ) {
		cin >> b[ i ];
	}
	int q, l, r, x;
	cin >> q;
	while ( q -- ) {
		num ++;
		cin >> l >> r >> x;
		if ( l > r ) {
			for ( int i = l; i <= m; i ++ ) {
				if ( b[ a[ i ] ] <= 0 )
					continue;
				b[ a[ i ] ] -= x;
				if ( b[ a[ i ] ] <= 0 )
					mp[ a[ i ] ] = num;
			}
			for ( int i = 1; i <= r; i ++ ) {
				if ( b[ a[ i ] ] <= 0 )
					continue;
				b[ a[ i ] ] -= x;
				if ( b[ a[ i ] ] <= 0 )
					mp[ a[ i ] ] = num;
			}
		}
		else {
			for ( int i = l; i <= r; i ++ ) {
				if ( b[ a[ i ] ] <= 0 )
					continue;
				b[ a[ i ] ] -= x;
				if ( b[ a[ i ] ] <= 0 )
					mp[ a[ i ] ] = num;
			}
		}
	}
	for ( int i = 1; i <= n; i ++ ) {
		if ( !mp[ i ] )
			cout << "NIE\n";
		else
			cout << mp[ i ] << "\n";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 216 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 454 ms 508 KB Output is correct
2 Correct 5407 ms 744 KB Output is correct
3 Correct 2787 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1626 ms 560 KB Output is correct
2 Correct 2160 ms 580 KB Output is correct
3 Correct 1813 ms 692 KB Output is correct
4 Correct 10 ms 588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1941 ms 524 KB Output is correct
2 Correct 4692 ms 684 KB Output is correct
3 Correct 28 ms 204 KB Output is correct
4 Correct 1981 ms 628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2607 ms 496 KB Output is correct
2 Correct 4323 ms 572 KB Output is correct
3 Correct 1388 ms 508 KB Output is correct
4 Correct 5148 ms 816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6020 ms 1856 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6021 ms 1740 KB Time limit exceeded
2 Halted 0 ms 0 KB -