제출 #1098275

#제출 시각아이디문제언어결과실행 시간메모리
1098275alexander707070말 (IOI15_horses)C++14
0 / 100
23 ms26452 KiB
#include<bits/stdc++.h> #include "horses.h" #define MAXN 500007 using namespace std; const long long mod=1e9+7; int n; long long x[MAXN],y[MAXN]; int calc(){ int best=0; long long mult=1; for(int i=1;i<=n;i++){ mult*=x[i]; if(mult>mod or mult*y[i]>y[best]){ best=i; mult=1; } } mult=1; for(int i=1;i<=best;i++){ mult*=x[i]; mult%=mod; } mult*=y[best]; mult%=mod; return mult; } int init(int N, int X[], int Y[]) { n=N; for(int i=1;i<=n;i++){ x[i]=X[i-1]; y[i]=Y[i-1]; } } int updateX(int pos, int val) { x[pos+1]=val; return calc(); } int updateY(int pos, int val) { y[pos+1]=val; return calc(); } /*int main(){ init(3,{2,1,3},{3,4,1}); cout<<updateY(1,2)<<"\n"; return 0; }*/

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

horses.cpp: In function 'int calc()':
horses.cpp:30:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   30 |     return mult;
      |            ^~~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^
#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...