제출 #427011

#제출 시각아이디문제언어결과실행 시간메모리
427011ollel말 (IOI15_horses)C++17
0 / 100
1578 ms15944 KiB
#include <bits/stdc++.h> #include <iostream> using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define lso(x) x&(-x) typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; vi X, Y, T; int n, N; ll get() { int start = n - 1; ll pr = X[start]; while (pr < 1e9) { start--; if (start == 0) break; pr *= X[start]; } T.assign(n, 1); rep(i, start, n) { if (i == 0) T[i] = X[i]; else T[i] = T[i - 1] * X[i]; } ll best = 0; rep(i, start, n) { best = max(best, T[i] * Y[i]); } best = best % 1000000009; ll mult_prev = 1; rep(i, 0, start) mult_prev = (mult_prev * X[i]) % 1000000009; best = (best * mult_prev) % 1000000009; return best; } int init(int a, int x[], int y[]) { n = N = a; X.resize(N); Y.resize(N); T.resize(N); rep(i,0,N) X[i] = x[i]; rep(i,0,N) Y[i] = y[i]; return get(); } int updateX(int pos, int val) { X[pos] = val; return get(); } int updateY(int pos, int val) { Y[pos] = val; return get(); } // // int main() { // int x[] = {1, 1, 1000000000, 1000000000, 1000000000}; // int y[] = {1, 1, 1, 1, 1000000000}; // cout << init(5, x, y); // }

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'll get()':
horses.cpp:19:10: warning: conversion from 'll' {aka 'long long int'} to 'double' may change value [-Wconversion]
   19 |   while (pr < 1e9) {
      |          ^~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:48:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   48 |   return get();
      |          ~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:53:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   53 |   return get();
      |          ~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:58:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   58 |   return get();
      |          ~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...