제출 #792077

#제출 시각아이디문제언어결과실행 시간메모리
792077acatmeowmeow말 (IOI15_horses)C++11
34 / 100
1579 ms15860 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; #define int long long const int NMAX = 5e5, modulo = 1e9 + 7; int n, x[NMAX + 5], y[NMAX + 5]; int compute() { int index = n - 1; for (int i = n - 2; i >= 0; i--) { int res = y[index], j = i + 1; while (res <= y[i] && j <= index) res *= x[j++]; if (res <= y[i]) index = i; } int ans = 1; for (int i = 0; i <= index; i++) ans *= x[i], ans %= modulo; ans *= y[index], ans %= modulo; return ans; } signed init(signed N, signed X[], signed Y[]) { n = N; for (int i = 0; i < n; i++) x[i] = X[i], y[i] = Y[i]; return compute(); } signed updateX(signed pos, signed val) { x[pos] = val; return compute(); } signed updateY(signed pos, signed val) { y[pos] = val; return compute(); } /*signed main() { //_inputFile = fopen("horses.in", "rb"); //_outputFile = fopen("horses.out", "w"); signed N; cin >> N; signed *X = (signed*)malloc(sizeof(signed)*(unsigned)N); signed *Y = (signed*)malloc(sizeof(signed)*(unsigned)N); for (int i = 0; i < N; i++) { cin >> X[i]; } for (int i = 0; i < N; i++) { cin >> Y[i]; } //fprintf(_outputFile,"%d\n",init(N,X,Y)); cout << init(N, X, Y) << '\n'; signed M; cin >> M; for (int i = 0; i < M; i++) { signed type; cin >> type; signed pos; cin >> pos; signed val; cin >> val; if (type == 1) { //fprintf(_outputFile,"%d\n",updateX(pos,val)); cout << updateX(pos, val) << '\n'; } else if (type == 2) { //fprintf(_outputFile,"%d\n",updateY(pos,val)); cout << updateY(pos, val) << '\n'; } } return 0; }*/

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:27:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   27 |  return compute();
      |         ~~~~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:32:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   32 |  return compute();
      |         ~~~~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:37:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   37 |  return compute();
      |         ~~~~~~~^~
#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...