Submission #48225

# Submission time Handle Problem Language Result Execution time Memory
48225 2018-05-10T23:58:08 Z qkrghdqls1 Boat (APIO16_boat) C++14
9 / 100
2000 ms 207168 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);
			auto it2=m.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:36:9: warning: variable 'it2' set but not used [-Wunused-but-set-variable]
    auto it2=m.find(j);
         ^~~
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]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 18 ms 376 KB Output is correct
2 Correct 20 ms 508 KB Output is correct
3 Correct 18 ms 508 KB Output is correct
4 Correct 17 ms 552 KB Output is correct
5 Correct 17 ms 564 KB Output is correct
6 Correct 17 ms 580 KB Output is correct
7 Correct 17 ms 640 KB Output is correct
8 Correct 17 ms 780 KB Output is correct
9 Correct 16 ms 780 KB Output is correct
10 Correct 17 ms 780 KB Output is correct
11 Correct 17 ms 972 KB Output is correct
12 Correct 17 ms 972 KB Output is correct
13 Correct 17 ms 972 KB Output is correct
14 Correct 17 ms 972 KB Output is correct
15 Correct 17 ms 972 KB Output is correct
16 Correct 3 ms 996 KB Output is correct
17 Correct 3 ms 1048 KB Output is correct
18 Correct 3 ms 1048 KB Output is correct
19 Correct 3 ms 1048 KB Output is correct
20 Correct 3 ms 1048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 376 KB Output is correct
2 Correct 20 ms 508 KB Output is correct
3 Correct 18 ms 508 KB Output is correct
4 Correct 17 ms 552 KB Output is correct
5 Correct 17 ms 564 KB Output is correct
6 Correct 17 ms 580 KB Output is correct
7 Correct 17 ms 640 KB Output is correct
8 Correct 17 ms 780 KB Output is correct
9 Correct 16 ms 780 KB Output is correct
10 Correct 17 ms 780 KB Output is correct
11 Correct 17 ms 972 KB Output is correct
12 Correct 17 ms 972 KB Output is correct
13 Correct 17 ms 972 KB Output is correct
14 Correct 17 ms 972 KB Output is correct
15 Correct 17 ms 972 KB Output is correct
16 Correct 3 ms 996 KB Output is correct
17 Correct 3 ms 1048 KB Output is correct
18 Correct 3 ms 1048 KB Output is correct
19 Correct 3 ms 1048 KB Output is correct
20 Correct 3 ms 1048 KB Output is correct
21 Correct 498 ms 1408 KB Output is correct
22 Correct 509 ms 1528 KB Output is correct
23 Correct 485 ms 1552 KB Output is correct
24 Correct 503 ms 1552 KB Output is correct
25 Correct 504 ms 1556 KB Output is correct
26 Correct 455 ms 1556 KB Output is correct
27 Correct 465 ms 1556 KB Output is correct
28 Correct 471 ms 1556 KB Output is correct
29 Correct 477 ms 1556 KB Output is correct
30 Execution timed out 2054 ms 93940 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2086 ms 207168 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 376 KB Output is correct
2 Correct 20 ms 508 KB Output is correct
3 Correct 18 ms 508 KB Output is correct
4 Correct 17 ms 552 KB Output is correct
5 Correct 17 ms 564 KB Output is correct
6 Correct 17 ms 580 KB Output is correct
7 Correct 17 ms 640 KB Output is correct
8 Correct 17 ms 780 KB Output is correct
9 Correct 16 ms 780 KB Output is correct
10 Correct 17 ms 780 KB Output is correct
11 Correct 17 ms 972 KB Output is correct
12 Correct 17 ms 972 KB Output is correct
13 Correct 17 ms 972 KB Output is correct
14 Correct 17 ms 972 KB Output is correct
15 Correct 17 ms 972 KB Output is correct
16 Correct 3 ms 996 KB Output is correct
17 Correct 3 ms 1048 KB Output is correct
18 Correct 3 ms 1048 KB Output is correct
19 Correct 3 ms 1048 KB Output is correct
20 Correct 3 ms 1048 KB Output is correct
21 Correct 498 ms 1408 KB Output is correct
22 Correct 509 ms 1528 KB Output is correct
23 Correct 485 ms 1552 KB Output is correct
24 Correct 503 ms 1552 KB Output is correct
25 Correct 504 ms 1556 KB Output is correct
26 Correct 455 ms 1556 KB Output is correct
27 Correct 465 ms 1556 KB Output is correct
28 Correct 471 ms 1556 KB Output is correct
29 Correct 477 ms 1556 KB Output is correct
30 Execution timed out 2054 ms 93940 KB Time limit exceeded
31 Halted 0 ms 0 KB -