Submission #1004440

# Submission time Handle Problem Language Result Execution time Memory
1004440 2024-06-21T09:00:26 Z vjudge1 Horses (IOI15_horses) C++17
17 / 100
99 ms 177236 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define f first
#define s second
#define pb push_back
#define pf push_front
#define pi pair<int,int>
#define vi vector<int>

int n ;
vi x, y;
ll dp[1000][10002];

ll init(int N, int X[], int Y[]){
    n = N;
    x.resize(N);
    y.resize(N);
    for(int i =0; i < n; i++){
        x[i] =X[i];
        y[i] = Y[i];
    }
    
    ll final = 0;
    
    for(int i = 0; i <= n; i++){
        for(int j= 0; j < 10001;j++){
            dp[i][j]=-LLONG_MAX;
        }
    }
    dp[0][1]=0;
    ll ans = 0;
    ll have = 1;
   for(int i = 1; i <= n; i++){
        have *= x[i-1];
        ans = max(ans, have*(y[i-1]));
         
   }
   return ans;

}


ll updateX(int pos, int val){
    
    x[pos]=val;
      ll ans = 0;
    ll have = 1;
   for(int i = 1; i <= n; i++){
        have *= x[i-1];
        ans = max(ans, have*(y[i-1]));
         
   }
   return ans;
}

ll updateY(int pos, int val){
     y[pos]=val;
      ll ans = 0;
    ll have = 1;
   for(int i = 1; i <= n; i++){
        have *= x[i-1];
        ans = max(ans, have*(y[i-1]));
         
   }
   return ans;
   
}

Compilation message

horses.cpp: In function 'long long int init(int, int*, int*)':
horses.cpp:24:8: warning: unused variable 'final' [-Wunused-variable]
   24 |     ll final = 0;
      |        ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 1212 KB Output is correct
3 Correct 0 ms 1116 KB Output is correct
4 Correct 1 ms 1220 KB Output is correct
5 Correct 0 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 0 ms 1116 KB Output is correct
8 Correct 0 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 1 ms 448 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 0 ms 1116 KB Output is correct
17 Correct 0 ms 860 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 1 ms 856 KB Output is correct
20 Correct 0 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1116 KB Output is correct
4 Correct 1 ms 1316 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 0 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 0 ms 1116 KB Output is correct
17 Correct 1 ms 856 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 1116 KB Output is correct
21 Incorrect 1 ms 1116 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 99 ms 177236 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
3 Correct 1 ms 1116 KB Output is correct
4 Correct 0 ms 1116 KB Output is correct
5 Correct 0 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 0 ms 1116 KB Output is correct
10 Correct 0 ms 1116 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 860 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 1 ms 1212 KB Output is correct
17 Correct 0 ms 860 KB Output is correct
18 Correct 0 ms 700 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 1116 KB Output is correct
21 Incorrect 1 ms 1116 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
3 Correct 1 ms 1116 KB Output is correct
4 Correct 1 ms 1212 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 0 ms 860 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 1116 KB Output is correct
21 Incorrect 1 ms 1116 KB Output isn't correct
22 Halted 0 ms 0 KB -