Submission #135424

# Submission time Handle Problem Language Result Execution time Memory
135424 2019-07-24T05:23:32 Z Boxworld Horses (IOI15_horses) C++14
34 / 100
1500 ms 8284 KB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
const long long bignum=1e9+7;
struct year{int x,y;}a[500100];
int n;
int cnt(){
    long long ans=0,m=0,ho=1,tmp=1;
    for (int i=0;i<n;i++){
        ho=ho*a[i].x%bignum;
        tmp=tmp*a[i].x;
        double t=double(a[m].y)/double(a[i].y);
        if (t<=tmp){
            ans=ho*a[i].y%bignum;
            m=i;tmp=1;
        }
    }
    return ans;
}
int init(int N, int X[], int Y[]){
    n=N;
    for (int i=0;i<n;i++){a[i].x=X[i];a[i].y=Y[i];}
	return cnt();
}

int updateX(int pos, int val) {
    a[pos].x=val;
    return cnt();
}

int updateY(int pos, int val) {
    a[pos].y=val;
    return cnt();
}

Compilation message

horses.cpp: In function 'int cnt()':
horses.cpp:13:16: warning: conversion to 'double' from 'long long int' may alter its value [-Wconversion]
         if (t<=tmp){
                ^~~
horses.cpp:18:12: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return ans;
            ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 128 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 252 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 252 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 252 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 9 ms 376 KB Output is correct
24 Correct 9 ms 424 KB Output is correct
25 Correct 10 ms 376 KB Output is correct
26 Correct 10 ms 376 KB Output is correct
27 Correct 9 ms 376 KB Output is correct
28 Correct 10 ms 376 KB Output is correct
29 Correct 10 ms 376 KB Output is correct
30 Correct 9 ms 380 KB Output is correct
31 Correct 9 ms 376 KB Output is correct
32 Correct 8 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1551 ms 8240 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 408 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 9 ms 380 KB Output is correct
24 Correct 9 ms 376 KB Output is correct
25 Correct 10 ms 376 KB Output is correct
26 Correct 10 ms 376 KB Output is correct
27 Correct 9 ms 376 KB Output is correct
28 Correct 9 ms 376 KB Output is correct
29 Correct 9 ms 376 KB Output is correct
30 Correct 10 ms 376 KB Output is correct
31 Correct 8 ms 380 KB Output is correct
32 Correct 8 ms 376 KB Output is correct
33 Execution timed out 1566 ms 8284 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 252 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 9 ms 376 KB Output is correct
24 Correct 9 ms 376 KB Output is correct
25 Correct 10 ms 380 KB Output is correct
26 Correct 10 ms 376 KB Output is correct
27 Correct 10 ms 376 KB Output is correct
28 Correct 10 ms 376 KB Output is correct
29 Correct 10 ms 376 KB Output is correct
30 Correct 9 ms 376 KB Output is correct
31 Correct 9 ms 376 KB Output is correct
32 Correct 8 ms 376 KB Output is correct
33 Execution timed out 1557 ms 8168 KB Time limit exceeded
34 Halted 0 ms 0 KB -