답안 #362514

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
362514 2021-02-03T13:03:15 Z flappybird Boat (APIO16_boat) C++14
9 / 100
2000 ms 162924 KB
#include <bits/stdc++.h>
using namespace std;
#define MAX 510
#define all(v) v.begin(), v.end()
#define ln '\n'
#define MOD 1000000007
#define INF 210000000000
#define pb push_back
#define abs(x) (((x)>0)?(x):(-(x)))
#define len(x) ((x).second-(x).first)
typedef long long ll;
map<int, int> m;
int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	int i, j, k;
	int a, b;
	int sum;
	m[0] = 1;
	map<int, int>::iterator it;
	for (i = 1; i <= N; i++) {
		cin >> a >> b;
		sum = 0;
		for (it = m.begin(); it != m.end(); it++) {
			if (it->first > b) break;
			sum += it->second;
			sum %= MOD;
		}
		for (j = b; j >= a; j--) {
			sum -= m[j];
			m[j] += sum;
			m[j] %= MOD;
			sum %= MOD;
		}
	}
	sum = 0;
	for (it = m.begin(); it != m.end(); it++) {
		if(it->first) sum += it->second, sum %= MOD;
	}
	while (sum < 0) sum += MOD;
	cout << sum << ln;
	return 0;
}

Compilation message

boat.cpp: In function 'int main()':
boat.cpp:18:12: warning: unused variable 'k' [-Wunused-variable]
   18 |  int i, j, k;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 152 ms 620 KB Output is correct
22 Correct 162 ms 748 KB Output is correct
23 Correct 152 ms 748 KB Output is correct
24 Correct 155 ms 620 KB Output is correct
25 Correct 164 ms 620 KB Output is correct
26 Correct 152 ms 620 KB Output is correct
27 Correct 156 ms 620 KB Output is correct
28 Correct 154 ms 492 KB Output is correct
29 Correct 159 ms 620 KB Output is correct
30 Execution timed out 2096 ms 27760 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2076 ms 162924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 152 ms 620 KB Output is correct
22 Correct 162 ms 748 KB Output is correct
23 Correct 152 ms 748 KB Output is correct
24 Correct 155 ms 620 KB Output is correct
25 Correct 164 ms 620 KB Output is correct
26 Correct 152 ms 620 KB Output is correct
27 Correct 156 ms 620 KB Output is correct
28 Correct 154 ms 492 KB Output is correct
29 Correct 159 ms 620 KB Output is correct
30 Execution timed out 2096 ms 27760 KB Time limit exceeded
31 Halted 0 ms 0 KB -