Submission #865064

# Submission time Handle Problem Language Result Execution time Memory
865064 2023-10-24T05:05:11 Z vjudge1 Meteors (POI11_met) C++17
61 / 100
6000 ms 3420 KB
/*
   (( `'-""``""-'` ))
     )-__-_.._-__-(
   / --- (o _ o) --- \
   \ .-* ( .0. ) *-. /
   _'-. ,_ '=' _, .-'_
  / `;#'#'# - #'#'#;` \
 \_)) -----'#'----- ((_/
      # --------- #
      '# ------- #'
  /..-'# ------- #'-.\
  _\...-\'# -- #'/-.../_
  ((____)- '#' -(____))
    art by - Vinni01 / luchi abi
 
    cout << fixed << setprecision(6) << x;
    freopen ( "sum.in", "r", stdin )
*/
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization("unroll-loops")
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <unordered_map>
using namespace std ;
#define ll int
#define ff first
#define ss second
#define pb push_back 
#define pf push_front
#define UseOFF ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)
#define sz size
#define ins insert
#define new jweijofdg
const ll N = 1e5 + 111 ;
const ll k = 400 ;
ll sum[ N ] ;
ll a[ N ] ;
ll p[ N ] ;
ll cnt[ N ] ;
ll ANS[ N ] ; 
signed main()
{
    UseOFF ;
    ll n, m ;
    cin >> n >> m ;
    for( int i = 1 ; i <= m ; i++ )
    {
    	cin >> a[ i ] ;
    }
    for( int i = 1 ; i <= n ; i++ ) { cin >> p[ i ] ; ANS[ i ] = 1e9 ; } 
    ll q ;
    cin >> q ;
    for( int i = 1 ; i <= q ; i++ )
    {
    	ll l, r, x ;
    	cin >> l >> r >> x ;
    	ll r2 = r ;
    	if( l > r )
    	{

    		r = m ;
    	}
    	for( int j = l ; j <= r ; j++ )
    	{
    		cnt[ a[ j ] ] += x ;
    		//if( a[ j ] == 3 )cout << cnt[ a[ j ] ] << " " << p[ a[ j ] ] << " " << a[ j ] << " " << i << " " << x << '\n' ;
    		if( cnt[ a[ j ] ] >= p[ a[ j ] ] )
    		{
    			ANS[ a[ j ] ] = min( ANS[ a[ j ] ], i ) ;
    		}
    	}
    	if( l > r2 )
    	{
    		for( int j = 1 ; j <= r2 ; j++ )
    		{
	    		cnt[ a[ j ] ] += x ;
	    		//if( a[ j ] == 3 )cout << cnt[ a[ j ] ] << " " << p[ a[ j ] ] << " " << a[ j ] << " " << i << " " << x << '\n' ;
	    		if( cnt[ a[ j ] ] >= p[ a[ j ] ] )
	    		{
	    			ANS[ a[ j ] ] = min( ANS[ a[ j ] ], i ) ;
	    		}
    		}
    	}
    }
    for( int i = 1 ; i <= n ; i++ )
    {
    	if( ANS[ i ] == 1e9 ) { cout << "NIE\n" ; continue ; }
    	cout << ANS[ i ] << '\n' ;
    }
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1899 ms 944 KB Output is correct
2 Correct 2145 ms 2180 KB Output is correct
3 Correct 2290 ms 1920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1139 ms 1252 KB Output is correct
2 Correct 1659 ms 2004 KB Output is correct
3 Correct 3887 ms 2204 KB Output is correct
4 Correct 7 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2044 ms 852 KB Output is correct
2 Correct 2052 ms 2124 KB Output is correct
3 Correct 25 ms 860 KB Output is correct
4 Correct 1625 ms 2104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 6032 ms 1164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 3420 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 3172 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -