답안 #362529

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
362529 2021-02-03T14:48:48 Z flappybird Boat (APIO16_boat) C++14
9 / 100
2000 ms 227948 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 >= a) break;
			sum += it->second;
			sum %= MOD;
		}
		for (j = a; j <= b; j++) {
			sum += m[j];
			sum %= MOD;
			m[j] = sum;
		}
	}
	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 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 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 2 ms 384 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 384 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 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 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 2 ms 384 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 384 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 100 ms 620 KB Output is correct
22 Correct 101 ms 620 KB Output is correct
23 Correct 97 ms 620 KB Output is correct
24 Correct 104 ms 620 KB Output is correct
25 Correct 107 ms 640 KB Output is correct
26 Correct 98 ms 492 KB Output is correct
27 Correct 98 ms 492 KB Output is correct
28 Correct 101 ms 620 KB Output is correct
29 Correct 100 ms 492 KB Output is correct
30 Execution timed out 2098 ms 30316 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2117 ms 227948 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 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 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 2 ms 384 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 384 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 100 ms 620 KB Output is correct
22 Correct 101 ms 620 KB Output is correct
23 Correct 97 ms 620 KB Output is correct
24 Correct 104 ms 620 KB Output is correct
25 Correct 107 ms 640 KB Output is correct
26 Correct 98 ms 492 KB Output is correct
27 Correct 98 ms 492 KB Output is correct
28 Correct 101 ms 620 KB Output is correct
29 Correct 100 ms 492 KB Output is correct
30 Execution timed out 2098 ms 30316 KB Time limit exceeded
31 Halted 0 ms 0 KB -