Submission #1004443

# Submission time Handle Problem Language Result Execution time Memory
1004443 2024-06-21T09:03:19 Z vjudge1 Horses (IOI15_horses) C++17
0 / 100
1500 ms 10332 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;

const int mod = 1e9+7;

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;
    
  
    ll ans = 0;
    ll have = 1;
   for(int i = 1; i <= n; i++){
        have *= x[i-1];
        have %=mod;
        have+=mod;
        ans = max(ans, have*(y[i-1]));
         
   }
   return ans%mod;

}


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%mod;
}

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%mod;
   
}

Compilation message

horses.cpp: In function 'long long int init(int, int*, int*)':
horses.cpp:25:8: warning: unused variable 'final' [-Wunused-variable]
   25 |     ll final = 0;
      |        ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 436 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1528 ms 10332 KB Time limit exceeded
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 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -