답안 #832648

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832648 2023-08-21T12:58:41 Z gustason Inspections (NOI23_inspections) C++14
29 / 100
2000 ms 14652 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m, q;
	cin >> n >> m >> q;
	
	vector<pair<int, int>> a(m);
	vector<ll> s(q);
	for(auto& i : a) {
		cin >> i.first >> i.second;
	}
	
	for(auto& i : s) {
		cin >> i;
	}
	
	map<int, int> prev;
	map<int, int> mp;
	
	int t = 1;
	for(int i = 0; i < m; i++) {
		for(int j = a[i].first; j <= a[i].second; j++, t++) {
			if (prev.find(j) != prev.end()) {
				mp[t-prev[j]-1]++;
			}
			prev[j] = t;
		} 
	}	

	map<int, int> cnt;
	int sum = 0;
	for(auto& i : mp) {
		cnt[i.first] = sum + i.second;
		sum += i.second;
	}
	//for(auto& i : cnt) {
		//cout << i.first << " " << i.second << "\n";
	//}
		
	for(int i = 0; i < q; i++) {
		auto it = cnt.lower_bound(s[i]);
		if (it == cnt.begin()) {
			cout << sum << " ";
			continue;
		}
		it--;
		cout << sum - it->second << " "; 
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 235 ms 3204 KB Output is correct
14 Correct 33 ms 2772 KB Output is correct
15 Correct 324 ms 3172 KB Output is correct
16 Correct 321 ms 3276 KB Output is correct
17 Correct 58 ms 3164 KB Output is correct
18 Correct 312 ms 3228 KB Output is correct
19 Correct 229 ms 3736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 311 ms 2768 KB Output is correct
4 Execution timed out 2091 ms 14208 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 235 ms 3204 KB Output is correct
14 Correct 33 ms 2772 KB Output is correct
15 Correct 324 ms 3172 KB Output is correct
16 Correct 321 ms 3276 KB Output is correct
17 Correct 58 ms 3164 KB Output is correct
18 Correct 312 ms 3228 KB Output is correct
19 Correct 229 ms 3736 KB Output is correct
20 Execution timed out 2076 ms 14652 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 235 ms 3204 KB Output is correct
14 Correct 33 ms 2772 KB Output is correct
15 Correct 324 ms 3172 KB Output is correct
16 Correct 321 ms 3276 KB Output is correct
17 Correct 58 ms 3164 KB Output is correct
18 Correct 312 ms 3228 KB Output is correct
19 Correct 229 ms 3736 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 311 ms 2768 KB Output is correct
23 Execution timed out 2091 ms 14208 KB Time limit exceeded
24 Halted 0 ms 0 KB -