답안 #865504

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865504 2023-10-24T09:12:12 Z vjudge1 Meteors (POI11_met) C++17
0 / 100
6000 ms 5208 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")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Incorrect 1 ms 4440 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1739 ms 4556 KB Output is correct
2 Correct 2762 ms 4948 KB Output is correct
3 Incorrect 2634 ms 4564 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1225 ms 4696 KB Output is correct
2 Incorrect 1690 ms 4552 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2473 ms 4804 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6040 ms 4444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6008 ms 5208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6047 ms 5204 KB Time limit exceeded
2 Halted 0 ms 0 KB -