Submission #865067

# Submission time Handle Problem Language Result Execution time Memory
865067 2023-10-24T05:06:29 Z vjudge1 Meteors (POI11_met) C++17
61 / 100
6000 ms 2136 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' ;
    }
}

Compilation message

met.cpp:21: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   21 | #pragma GCC optimization("unroll-loops")
      |
# 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 1 ms 480 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 1700 ms 1620 KB Output is correct
2 Correct 2193 ms 1744 KB Output is correct
3 Correct 2243 ms 1644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 963 ms 1656 KB Output is correct
2 Correct 1439 ms 1560 KB Output is correct
3 Correct 3333 ms 1584 KB Output is correct
4 Correct 7 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1625 ms 1484 KB Output is correct
2 Correct 2253 ms 1620 KB Output is correct
3 Correct 22 ms 860 KB Output is correct
4 Correct 1215 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 6022 ms 1104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 2136 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 2136 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -