# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1011240 |
2024-06-30T07:32:55 Z |
mindiyak |
Horses (IOI15_horses) |
C++14 |
|
1500 ms |
18248 KB |
#include "horses.h"
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;
int n;
vl x,y;
ll multi(ll a,ll b){
return ((a%MOD)*(b%MOD))%MOD;
}
ll calc(){
ll cur = 1;
int pos = 0;
FOR(i,1,n){
cur *= x[i];
if(cur*y[i] >= y[pos]){
cur = 1;
pos = i;
}
}
ll MX = 1;
for(int i=0;i<pos+1;i++){
MX = multi(MX,x[i]);
}
return multi(y[pos],MX);
}
int init(int N, int X[], int Y[]) {
n=N;
FOR(i,0,n)x.pb(X[i]);
FOR(i,0,n)y.pb(Y[i]);
return calc();
}
int updateX(int pos, int val) {
x[pos] = val;
return calc();
}
int updateY(int pos, int val) {
y[pos] = val;
return calc();
}
Compilation message
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:71:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
71 | return calc();
| ~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:77:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
77 | return calc();
| ~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:82:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
82 | return calc();
| ~~~~^~
# |
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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
436 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
436 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
436 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
436 KB |
Output is correct |
23 |
Correct |
6 ms |
348 KB |
Output is correct |
24 |
Correct |
6 ms |
448 KB |
Output is correct |
25 |
Correct |
6 ms |
496 KB |
Output is correct |
26 |
Correct |
6 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
348 KB |
Output is correct |
28 |
Correct |
6 ms |
348 KB |
Output is correct |
29 |
Correct |
6 ms |
348 KB |
Output is correct |
30 |
Correct |
6 ms |
348 KB |
Output is correct |
31 |
Correct |
3 ms |
484 KB |
Output is correct |
32 |
Correct |
5 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1572 ms |
16388 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
6 ms |
348 KB |
Output is correct |
24 |
Correct |
6 ms |
344 KB |
Output is correct |
25 |
Correct |
6 ms |
348 KB |
Output is correct |
26 |
Correct |
6 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
344 KB |
Output is correct |
28 |
Correct |
6 ms |
348 KB |
Output is correct |
29 |
Correct |
6 ms |
444 KB |
Output is correct |
30 |
Correct |
7 ms |
348 KB |
Output is correct |
31 |
Correct |
3 ms |
444 KB |
Output is correct |
32 |
Correct |
5 ms |
348 KB |
Output is correct |
33 |
Execution timed out |
1580 ms |
18248 KB |
Time limit exceeded |
34 |
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 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
6 ms |
348 KB |
Output is correct |
24 |
Correct |
6 ms |
480 KB |
Output is correct |
25 |
Correct |
6 ms |
348 KB |
Output is correct |
26 |
Correct |
6 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
448 KB |
Output is correct |
28 |
Correct |
6 ms |
348 KB |
Output is correct |
29 |
Correct |
6 ms |
440 KB |
Output is correct |
30 |
Correct |
6 ms |
348 KB |
Output is correct |
31 |
Correct |
3 ms |
348 KB |
Output is correct |
32 |
Correct |
6 ms |
348 KB |
Output is correct |
33 |
Execution timed out |
1589 ms |
16436 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |