제출 #424427

#제출 시각아이디문제언어결과실행 시간메모리
424427Ozy말 (IOI15_horses)C++17
0 / 100
15 ms10444 KiB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl

lli x[1002],y[1002],n,MAX,a;

int init(int N, int X[], int Y[]) {

    n = N;
    MAX = 0;

    rep (i,0,n-1) {
        x[i] = X[i] + x[i-1];
        y[i] = Y[i];

        a = x[i] * y[i];
        if (a > MAX) MAX = a;
    }

    return MAX;
}

int updateX(int pos, int val) {
	lli pas = x[pos];

	rep(i,pos,n-1) {
        x[i] /= pas;
        x[i] *= val;
        a = x[i]*y[i];
        if (a > MAX) MAX = a;
	}

	return MAX;
}

int updateY(int pos, int val) {
    y[pos] = val;
    a = y[pos] * x[pos];
    if (a > MAX) MAX = a;
    return MAX;
}

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:25:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   25 |     return MAX;
      |            ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:38:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   38 |  return MAX;
      |         ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:45:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   45 |     return MAX;
      |            ^~~
#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...