답안 #918758

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918758 2024-01-30T11:42:24 Z Aiperiii 말 (IOI15_horses) C++14
17 / 100
1500 ms 14008 KB
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int N=1e5,mod=1e9+7;
int X[N],Y[N];
vector <ll> x,y;
int init(int N, int X[], int Y[]) {
   x.pb(0);y.pb(0);
   for(int i=0;i<N;i++){
      x.pb(X[i]);
      y.pb(Y[i]);
   }
   ll d=1;
   ll mx=0;
   int n=x.size()-1;
   for(int i=1;i<=n;i++){
      d*=x[i];
      d%=mod;
      mx=max(mx,(d*y[i])%mod);
   }
   return mx%mod;
}
int updateX(int pos,int val){
   pos++;
   x[pos]=val;
   ll d=1;
   ll mx=0;
   int n=x.size()-1;
   for(int i=1;i<=n;i++){
      d*=x[i];
      d%=mod;
      mx=max(mx,(d*y[i])%mod);
   }
   return mx%mod;
}
int updateY(int pos,int val){
   pos++;
   y[pos]=val;
   ll d=1;
   ll mx=0;
   int n=y.size()-1;
   for(int i=1;i<=n;i++){
      d*=x[i];
      d%=mod;
      mx=max(mx,(d*y[i])%mod);
   }
   return mx%mod;
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:11:30: warning: declaration of 'Y' shadows a global declaration [-Wshadow]
   11 | int init(int N, int X[], int Y[]) {
      |                          ~~~~^~~
horses.cpp:9:10: note: shadowed declaration is here
    9 | int X[N],Y[N];
      |          ^
horses.cpp:11:21: warning: declaration of 'X' shadows a global declaration [-Wshadow]
   11 | int init(int N, int X[], int Y[]) {
      |                 ~~~~^~~
horses.cpp:9:5: note: shadowed declaration is here
    9 | int X[N],Y[N];
      |     ^
horses.cpp:11:14: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   11 | int init(int N, int X[], int Y[]) {
      |          ~~~~^
horses.cpp:8:11: note: shadowed declaration is here
    8 | const int N=1e5,mod=1e9+7;
      |           ^
horses.cpp:19:18: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   19 |    int n=x.size()-1;
      |          ~~~~~~~~^~
horses.cpp:25:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   25 |    return mx%mod;
      |           ~~^~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:32:18: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   32 |    int n=x.size()-1;
      |          ~~~~~~~~^~
horses.cpp:38:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   38 |    return mx%mod;
      |           ~~^~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:45:18: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   45 |    int n=y.size()-1;
      |          ~~~~~~~~^~
horses.cpp:51:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   51 |    return mx%mod;
      |           ~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 556 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 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 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 600 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Incorrect 0 ms 344 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1538 ms 14008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 344 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 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 1 ms 344 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 344 KB Output is correct
21 Incorrect 0 ms 344 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 600 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 600 KB Output is correct
21 Incorrect 1 ms 600 KB Output isn't correct
22 Halted 0 ms 0 KB -