답안 #1088276

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1088276 2024-09-14T07:41:10 Z dosts 말 (IOI15_horses) C++17
17 / 100
1500 ms 14172 KB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " <<    
#define all(cont) cont.begin(),cont.end()
#define vi vector<int>
const int MOD = 1e9+7,inf = 2e14;
const int N = 5e5+50;

int add(int x,int y) {
	return ((x+y) >= MOD ? x+y-MOD : x+y);
}

int mult(int x,int y) {
	return ((x%MOD)*(y%MOD))%MOD;
}

int x[N],y[N];

int32_t init(int32_t N, int32_t X[], int32_t Y[]) {
	for (int i=0;i<N;i++) x[i] = X[i],y[i] = Y[i];
	int mlt = 1;
	int ans = 0;
	for (int i=0;i<N;i++) {
		mlt = mult(mlt,X[i]);
		ans = max(ans,mlt*Y[i]);
	}
	return ans;
}

int32_t updateX(int32_t pos, int32_t val) {	
	x[pos] = val;
	int mlt = 1;
	int ans = 0;
	for (int i=0;i<N;i++) {
		mlt = mult(mlt,x[i]);
		ans = max(ans,mlt*y[i]);
	}
	return ans;
}

int32_t updateY(int32_t pos, int32_t val) {
	y[pos] = val;
	int mlt = 1;
	int ans = 0;
	for (int i=0;i<N;i++) {
		mlt = mult(mlt,x[i]);
		ans = max(ans,mlt*y[i]);
	}
	return ans;
}

Compilation message

horses.cpp: In function 'int32_t init(int32_t, int32_t*, int32_t*)':
horses.cpp:24:22: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   24 | int32_t init(int32_t N, int32_t X[], int32_t Y[]) {
      |              ~~~~~~~~^
horses.cpp:12:11: note: shadowed declaration is here
   12 | const int N = 5e5+50;
      |           ^
horses.cpp:32:9: warning: conversion from 'long long int' to 'int32_t' {aka 'int'} may change value [-Wconversion]
   32 |  return ans;
      |         ^~~
horses.cpp: In function 'int32_t updateX(int32_t, int32_t)':
horses.cpp:43:9: warning: conversion from 'long long int' to 'int32_t' {aka 'int'} may change value [-Wconversion]
   43 |  return ans;
      |         ^~~
horses.cpp: In function 'int32_t updateY(int32_t, int32_t)':
horses.cpp:54:9: warning: conversion from 'long long int' to 'int32_t' {aka 'int'} may change value [-Wconversion]
   54 |  return ans;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 600 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Incorrect 13 ms 460 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1541 ms 14172 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 444 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 448 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 452 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 352 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Incorrect 14 ms 468 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 448 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Incorrect 13 ms 348 KB Output isn't correct
22 Halted 0 ms 0 KB -