Submission #929054

# Submission time Handle Problem Language Result Execution time Memory
929054 2024-02-17T15:25:10 Z OAleksa Horses (IOI15_horses) C++14
17 / 100
1500 ms 10424 KB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 5e5 + 69;
int n, a[N], b[N];
int mul(int a, int b) {
   long long r = 1ll * a * b;
   if (r >= mod)
      r %= mod;
   return r;
}
int init(int N, int X[], int Y[]) {
   n = N;
   for (int i = 0;i < n;i++)
      a[i] = X[i], b[i] = Y[i];
   long long ans = 0, x = 1;
   for (int i = 0;i < n;i++) {
      x *= a[i];
      ans = max(ans, x * b[i]);
   }
   return ans % mod;
}

int updateX(int pos, int val) {
   a[pos] = val;
	long long ans = 0, x = 1;
   for (int i = 0;i < n;i++) {
      x *= a[i];
      ans = max(ans, x * b[i]);
   }
   return ans % mod;
}

int updateY(int pos, int val) {
	b[pos] = val;
	long long ans = 0, x = 1;
   for (int i = 0;i < n;i++) {
      x *= a[i];
      ans = max(ans, x * b[i]);
   }
   return ans % mod;
}

Compilation message

horses.cpp: In function 'int mul(int, int)':
horses.cpp:7:20: warning: declaration of 'b' shadows a global declaration [-Wshadow]
    7 | int mul(int a, int b) {
      |                ~~~~^
horses.cpp:6:14: note: shadowed declaration is here
    6 | int n, a[N], b[N];
      |              ^
horses.cpp:7:13: warning: declaration of 'a' shadows a global declaration [-Wshadow]
    7 | int mul(int a, int b) {
      |         ~~~~^
horses.cpp:6:8: note: shadowed declaration is here
    6 | int n, a[N], b[N];
      |        ^
horses.cpp:11:11: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   11 |    return r;
      |           ^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:13:14: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   13 | int init(int N, int X[], int Y[]) {
      |          ~~~~^
horses.cpp:5:11: note: shadowed declaration is here
    5 | const int N = 5e5 + 69;
      |           ^
horses.cpp:22:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   22 |    return ans % mod;
      |           ~~~~^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:32:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   32 |    return ans % mod;
      |           ~~~~^~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:42:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |    return ans % mod;
      |           ~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2480 KB Output is correct
3 Correct 0 ms 2492 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2488 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 0 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2468 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Incorrect 1 ms 2396 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1520 ms 10424 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2648 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Incorrect 1 ms 2396 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2492 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2496 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Incorrect 1 ms 2396 KB Output isn't correct
22 Halted 0 ms 0 KB -