답안 #48227

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48227 2018-05-11T00:00:32 Z qkrghdqls1 Boat (APIO16_boat) C++14
9 / 100
2000 ms 211356 KB
#include<bits/stdc++.h>
using namespace std;
int a[501],b[501],mod=1000000007;
vector<int> v;
map<int,int> m;
map<int,int> su;
int main()
{
	/*int n,cnt=1;
	  scanf("%d",&n);
	  for(int i=1;i<=n;i++){
	  scanf("%d %d",&a[i],&b[i]);
	  v.push_back(a[i]);
	  v.push_back(b[i]);
	  }
	  sort(v.begin(),v.end());
	  unique(v.begin(),v.end());
	  while(cnt<v.size()&&v[cnt-1]<v[cnt]) cnt++;*/
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);
		for(int j=a[i];j<=b[i];j++) m[j]=0;
	}
	m[0]=1;
	int s=0;
	for(int i=0;i<n;i++){
		s=0;
		for(auto it=m.begin();it!=m.end();it++){
			s=(s+it->second)%mod;
			su[it->first]=s;
		}
		for(int j=b[i];j>=a[i];j--)
		{
			auto it=su.find(j);
			it--;
			m[j]=(m[j]+it->second)%mod;
		}
	}
	s=0;
	for(auto it=m.begin();it!=m.end();it++){
		s=(s+it->second)%mod;
		su[it->first]=s;
	}
	printf("%d",(s-1+mod)%mod);
}

Compilation message

boat.cpp: In function 'int main()':
boat.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
boat.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&a[i],&b[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 376 KB Output is correct
2 Correct 17 ms 488 KB Output is correct
3 Correct 18 ms 488 KB Output is correct
4 Correct 17 ms 488 KB Output is correct
5 Correct 17 ms 488 KB Output is correct
6 Correct 16 ms 488 KB Output is correct
7 Correct 17 ms 488 KB Output is correct
8 Correct 16 ms 644 KB Output is correct
9 Correct 17 ms 644 KB Output is correct
10 Correct 17 ms 644 KB Output is correct
11 Correct 16 ms 644 KB Output is correct
12 Correct 16 ms 648 KB Output is correct
13 Correct 17 ms 648 KB Output is correct
14 Correct 17 ms 700 KB Output is correct
15 Correct 17 ms 700 KB Output is correct
16 Correct 3 ms 700 KB Output is correct
17 Correct 3 ms 700 KB Output is correct
18 Correct 3 ms 700 KB Output is correct
19 Correct 3 ms 700 KB Output is correct
20 Correct 3 ms 700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 376 KB Output is correct
2 Correct 17 ms 488 KB Output is correct
3 Correct 18 ms 488 KB Output is correct
4 Correct 17 ms 488 KB Output is correct
5 Correct 17 ms 488 KB Output is correct
6 Correct 16 ms 488 KB Output is correct
7 Correct 17 ms 488 KB Output is correct
8 Correct 16 ms 644 KB Output is correct
9 Correct 17 ms 644 KB Output is correct
10 Correct 17 ms 644 KB Output is correct
11 Correct 16 ms 644 KB Output is correct
12 Correct 16 ms 648 KB Output is correct
13 Correct 17 ms 648 KB Output is correct
14 Correct 17 ms 700 KB Output is correct
15 Correct 17 ms 700 KB Output is correct
16 Correct 3 ms 700 KB Output is correct
17 Correct 3 ms 700 KB Output is correct
18 Correct 3 ms 700 KB Output is correct
19 Correct 3 ms 700 KB Output is correct
20 Correct 3 ms 700 KB Output is correct
21 Correct 448 ms 1096 KB Output is correct
22 Correct 445 ms 1096 KB Output is correct
23 Correct 428 ms 1096 KB Output is correct
24 Correct 447 ms 1132 KB Output is correct
25 Correct 453 ms 1132 KB Output is correct
26 Correct 404 ms 1132 KB Output is correct
27 Correct 406 ms 1132 KB Output is correct
28 Correct 402 ms 1132 KB Output is correct
29 Correct 407 ms 1132 KB Output is correct
30 Execution timed out 2075 ms 93488 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2082 ms 211356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 376 KB Output is correct
2 Correct 17 ms 488 KB Output is correct
3 Correct 18 ms 488 KB Output is correct
4 Correct 17 ms 488 KB Output is correct
5 Correct 17 ms 488 KB Output is correct
6 Correct 16 ms 488 KB Output is correct
7 Correct 17 ms 488 KB Output is correct
8 Correct 16 ms 644 KB Output is correct
9 Correct 17 ms 644 KB Output is correct
10 Correct 17 ms 644 KB Output is correct
11 Correct 16 ms 644 KB Output is correct
12 Correct 16 ms 648 KB Output is correct
13 Correct 17 ms 648 KB Output is correct
14 Correct 17 ms 700 KB Output is correct
15 Correct 17 ms 700 KB Output is correct
16 Correct 3 ms 700 KB Output is correct
17 Correct 3 ms 700 KB Output is correct
18 Correct 3 ms 700 KB Output is correct
19 Correct 3 ms 700 KB Output is correct
20 Correct 3 ms 700 KB Output is correct
21 Correct 448 ms 1096 KB Output is correct
22 Correct 445 ms 1096 KB Output is correct
23 Correct 428 ms 1096 KB Output is correct
24 Correct 447 ms 1132 KB Output is correct
25 Correct 453 ms 1132 KB Output is correct
26 Correct 404 ms 1132 KB Output is correct
27 Correct 406 ms 1132 KB Output is correct
28 Correct 402 ms 1132 KB Output is correct
29 Correct 407 ms 1132 KB Output is correct
30 Execution timed out 2075 ms 93488 KB Time limit exceeded
31 Halted 0 ms 0 KB -