답안 #832611

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832611 2023-08-21T12:36:52 Z gustason Inspections (NOI23_inspections) C++14
0 / 100
2000 ms 10384 KB
#include <bits/stdc++.h>
using namespace std;

int 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<int> s(q);
	for(auto& i : a) {
		cin >> i.first >> i.second;
	}
	
	for(int& 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 1 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 Incorrect 2 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 Incorrect 2 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 300 ms 1808 KB Output is correct
4 Execution timed out 2056 ms 10384 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 Incorrect 2 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 Incorrect 2 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -