#include "horses.h"
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
struct segS
{
long long cnt=0, val=0;
segS operator+(segS b)
{
segS ans;
ans.val = max( val, (cnt * b.val)%mod );
ans.cnt = (cnt * b.cnt) % mod;
return ans;
}
};
int n;
long long x[100005], y[100005];
vector<segS> seg;
void upd(int i, int st, int dr, int p)
{
if(st == dr)
{
seg[p].cnt = x[i];
seg[p].val = (x[i] * y[i]) % mod;
}
}
int updateX(int pos, int val)
{
x[pos]=val;
upd(pos, 0, n-1, 1);
return (int)seg[1].val;
}
int updateY(int pos, int val)
{
y[pos]=val;
upd(pos, 0, n-1, 1);
return (int)seg[1].val;
}
int init(int N, int X[], int Y[])
{
n = N;
for(int i=0; i<n; i++)
{
x[i] = X[i];
y[i] = Y[i];
}
seg.resize(4*n+4);
for(int i=0;i<n;i++)
upd(i, 0, n-1, 1);
return (int)seg[1].val;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
15 ms |
11476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |