Submission #54769

# Submission time Handle Problem Language Result Execution time Memory
54769 2018-07-05T04:45:28 Z 1등은 나의 것^^(#2059) Calvinball championship (CEOI15_teams) C++11
10 / 100
281 ms 1188 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 10005, mod = 1e6+7;

ll n, a[N], mx[N], dt[2][N];

int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) {
		scanf("%lld",&a[i]);
		mx[i] = max(mx[i-1], a[i]);
	}
	for(int i=1;i<=n;i++) {
		dt[n%2][i] = 1;
	}
	ll ans = a[n];
	for(int i=n-1;i>=1;i--) {
		for(int j=1;j<=i;j++) {
			dt[i%2][j] = (dt[1-i%2][j] * j + dt[1-i%2][j+1]) % mod;
			if(j < a[i]) ans = (ans + dt[i%2][j]) % mod;
		}
	}
	printf("%lld\n",ans);
}

Compilation message

teams.cpp: In function 'int main()':
teams.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
teams.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 2 ms 520 KB Output is correct
4 Correct 2 ms 572 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 764 KB Output is correct
2 Incorrect 2 ms 812 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 812 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 281 ms 1112 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 1188 KB Output isn't correct
2 Halted 0 ms 0 KB -