답안 #496225

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496225 2021-12-21T03:25:56 Z mansur Meteors (POI11_met) C++17
74 / 100
6000 ms 3404 KB
#include<bits/stdc++.h>	
 
#pragma optimize ("g",on)
#pragma GCC optimize ("inline")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("03")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
#pragma comment(linker, "/stack:200000000")

//01001101 01100001 01101011 01101000 01100001  01100111 01100001 01111001 

using namespace std;

#define all(a) a.begin(), a.end()                                                   
#define rall(a) a.rbegin(), a.rend()
#define ll long long
#define pb push_back
#define sz(a) a.size()
#define nl '\n'
#define popb pop_back()                                                                   
#define ld double
#define ull unsigned long long
#define ff first                                         
#define ss second  
#define fix fixed << setprecision
#define pii pair<int, int>                          
#define E exit (0)
#define int long long
 
const int inf = 1e9, N = 1e6 + 1, mod = 998244353;                    

vector<pii> dir = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

int ans[N];

main() {                                                         
	//freopen("cowrect.in", "r", stdin);                                                                                     
	//freopen("cowrect.out", "w", stdout);                                                                                     
	ios_base::sync_with_stdio(NULL);                                                                                        
	cin.tie(NULL);
	int n, m;
	cin >> n >> m;
	int a[m + 1], b[n + 1];
	for (int i = 1; i <= m; i++) cin >> a[i];   
	for (int i = 1; i <= n; i++) cin >> b[i];
	int k;
	cin >> k;
	for (int i = 1; i <= k; i++) {
		int l, r, x;
		cin >> l >> r >> x;
		if (l <= r) {
			for (int j = l; j <= r; j++) {
				if (b[a[j]] && b[a[j]] <= x) {
					b[a[j]] = 0;
					ans[a[j]] = i; 	
				}else if(b[a[j]]) b[a[j]] -= x;	
			}
		}else {
			for (int j = l; j <= m; j++) {
				if (b[a[j]] && b[a[j]] <= x) {
					b[a[j]] = 0;
					ans[a[j]] = i; 	
				}else if(b[a[j]]) b[a[j]] -= x;	
			}
			for (int j = 1; j <= r; j++) {
				if (b[a[j]] && b[a[j]] <= x) {
					b[a[j]] = 0;
					ans[a[j]] = i; 	
				}else if(b[a[j]]) b[a[j]] -= x;	
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		if (ans[i] == 0) cout << "NIE" << nl;
		else cout << ans[i] << nl;
	}
}

Compilation message

met.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    3 | #pragma optimize ("g",on)
      | 
met.cpp:9: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    9 | #pragma comment(linker, "/stack:200000000")
      | 
met.cpp:37:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 | main() {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 2 ms 332 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 3 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 451 ms 728 KB Output is correct
2 Correct 5569 ms 1228 KB Output is correct
3 Correct 2907 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1460 ms 844 KB Output is correct
2 Correct 2028 ms 844 KB Output is correct
3 Correct 1526 ms 1100 KB Output is correct
4 Correct 10 ms 972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1888 ms 748 KB Output is correct
2 Correct 4098 ms 1080 KB Output is correct
3 Correct 27 ms 204 KB Output is correct
4 Correct 1967 ms 952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2142 ms 692 KB Output is correct
2 Correct 4038 ms 844 KB Output is correct
3 Correct 1401 ms 716 KB Output is correct
4 Correct 4698 ms 1200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6078 ms 3404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6095 ms 3276 KB Time limit exceeded
2 Halted 0 ms 0 KB -