제출 #921646

#제출 시각아이디문제언어결과실행 시간메모리
921646coding_snorlax말 (IOI15_horses)C++14
17 / 100
1519 ms10424 KiB
//#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int n;
int x[500005];
int y[500005];
int init(int N, int X[], int Y[]) {
    n=N;
    for(int i=0;i<N;i++){
      x[i]=X[i];
      y[i]=Y[i];
    }
    ll answer = 1,tmp=1,i=-1;
    for(int I=N-1;I>=0;I--){
        if(tmp*X[i]>2000000000) {i=I;break;}
        tmp *= X[i];
    }
    if(i==-1) i=0;
    int place = i;
    ll Max=1,tmp2=1;
    for(int j=i;j<N;j++){
        tmp2*=X[j];
        tmp2*=Y[j];
        if(tmp2>Max){
            Max = tmp2;
            place = j;
        }
        tmp2/=Y[j];
    }
    for(int j=0;j<=place;j++){
        answer*=X[j];
        answer %= (1000000007);
    }
    answer*=Y[place];
    return answer % (1000000007);
}

int updateX(int pos, int val) {
    x[pos]=val;
    return init(n,x,y);
}
int updateY(int pos, int val) {
    y[pos]=val;
    return init(n,x,y);
}

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:20:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   20 |     int place = i;
      |                 ^
horses.cpp:22:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   22 |     for(int j=i;j<N;j++){
      |               ^
horses.cpp:36:19: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   36 |     return answer % (1000000007);
      |            ~~~~~~~^~~~~~~~~~~~~~
#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...