Submission #865508

# Submission time Handle Problem Language Result Execution time Memory
865508 2023-10-24T09:13:38 Z vjudge1 Meteors (POI11_met) C++17
0 / 100
6000 ms 5260 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 = 3e5 + 111 ;
const ll k = 400 ;
ll sum[ N ] ;
ll a[ N ] ;
ll p[ N ] ;
ll cnt[ N ] ;
ll ANS[ N ] ; 
bool kk[ N ] ;
signed main()
{
    UseOFF ;
    ll n, m ;
    cin >> n >> m ;
    ll cnt2 = 0 ;
    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 ;
    	//if( cnt2 == n ) continue ;
    	ll r2 = r ;
    	if( l > r )
    	{
    		r = m ;
    	}
    	for( int j = l ; j <= r ; j++ )
    	{
    		if( cnt[ a[ j ] >= p[ a[ j ] ] ] ) continue ;
    		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 ] ] )
    		{
    			//if( kk[ a[ j ] ] == 1 ) cnt2++ ;
    			//kk[ a[ j ] ] = 1 ;
    			ANS[ a[ j ] ] = min( ANS[ a[ j ] ], i ) ;
    		}
    	}
    	if( l > r2 )
    	{
    		for( int j = 1 ; j <= r2 ; j++ )
    		{
    			if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) continue ;
	    		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")
      | 
met.cpp: In function 'int main()':
met.cpp:71:8: warning: unused variable 'cnt2' [-Wunused-variable]
   71 |     ll cnt2 = 0 ;
      |        ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Incorrect 1 ms 4444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1715 ms 4544 KB Output is correct
2 Correct 2703 ms 4540 KB Output is correct
3 Incorrect 2464 ms 4692 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1135 ms 4696 KB Output is correct
2 Incorrect 1604 ms 4560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2214 ms 4644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6030 ms 4444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6035 ms 5208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6051 ms 5260 KB Time limit exceeded
2 Halted 0 ms 0 KB -