# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
142953 | 2019-08-12T10:44:30 Z | Ruxandra985 | Calvinball championship (CEOI15_teams) | C++14 | 437 ms | 596 KB |
#include <cstdio> #include <iostream> #include <cstring> #define DIMN 10010 #define MOD 1000000007 using namespace std; int v[DIMN],maxi_now[DIMN]; long long s[2][DIMN]; int main() { // FILE *fin = fopen ("a.in","r"); // FILE *fout = fopen ("a.out","w"); int n,i,lin,j; scanf ("%d",&n); for (i=1;i<=n;i++){ scanf ("%d",&v[i]); maxi_now[i] = max ( maxi_now[i-1] , v[i] ); } /// secv e de forma : prefix comun , v[i]-1 , orice respecta long long sol = 0; for (i=0;i<=n;i++) s[0][i] = 1; for (i=1;i<=n;i++){ lin = (i&1); for (j=1;j<=n;j++){ s[lin][j] = (s[1-lin][j-1] + (s[1-lin][j] * j)%MOD)%MOD; } /// sufixul pe care il modificam are lungimea i /// schimbi n-i ca sa scada lexicografic sol = (sol + (s[lin][maxi_now[n-i-1]] * (v[n-i] - 1)%MOD)%MOD); memset (s[1-lin] , 0 , sizeof(s[1-lin])); } printf ("%lld" , (sol + v[n])%MOD); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 2 ms | 508 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Incorrect | 2 ms | 504 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 504 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 536 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 520 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 13 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 413 ms | 588 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 437 ms | 596 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |