답안 #434468

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
434468 2021-06-21T10:44:36 Z Tangent 말 (IOI15_horses) C++17
34 / 100
1500 ms 8616 KB
#include "horses.h"
#include "bits/stdc++.h"
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
 
#define ffor(i, a, b) for (ll i = (a); i < (ll)(b); i++)
#define fford(i, a, b) for (ll i = (a); i > (ll)(b); i--)
#define rep(i, n) ffor(i, 0, n)
#define forin(x, a) for (auto &x: a)
#define all(a) a.begin(), a.end()

int n;
vii x, y;
ll mod = 1000000007;

int init(int N, int X[], int Y[]) {
	n = N;
	rep(i, n) {
		x.emplace_back(X[i]);
		y.emplace_back(Y[i]);
	}
	ll res = (x[0] * y[0]) % mod;
	ll curr = x[0], delta = 1;
	int p = 0;
	ffor(i, 1, n) {
		delta *= x[i];
		if (y[i] * delta >= y[p] || y[i] * delta < 0) {
			delta %= mod;
			curr *= delta;
			curr %= mod;
			res = curr * y[i];
			res %= mod;
			delta = 1;
			p = i;
		}
	}
	return res;
}

int updateX(int pos, int val) {
	x[pos] = val;
	ll res = (x[0] * y[0]) % mod;
	ll curr = x[0], delta = 1;
	int p = 0;
	ffor(i, 1, n) {
		delta *= x[i];
		if (y[i] * delta >= y[p] || y[i] * delta < 0) {
			delta %= mod;
			curr *= delta;
			curr %= mod;
			res = curr * y[i];
			res %= mod;
			delta = 1;
			p = i;
		}
	}
	return res;
}

int updateY(int pos, int val) {
	y[pos] = val;
	ll res = (x[0] * y[0]) % mod;
	ll curr = x[0], delta = 1;
	int p = 0;
	ffor(i, 1, n) {
		delta *= x[i];
		if (y[i] * delta >= y[p] || y[i] * delta < 0) {
			delta %= mod;
			curr *= delta;
			curr %= mod;
			res = curr * y[i];
			res %= mod;
			delta = 1;
			p = i;
		}
	}
	return res;
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:46:8: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   46 |    p = i;
      |        ^
horses.cpp:49:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   49 |  return res;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:66:8: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   66 |    p = i;
      |        ^
horses.cpp:69:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   69 |  return res;
      |         ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:86:8: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   86 |    p = i;
      |        ^
horses.cpp:89:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   89 |  return res;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 292 KB Output is correct
23 Correct 8 ms 308 KB Output is correct
24 Correct 8 ms 300 KB Output is correct
25 Correct 27 ms 352 KB Output is correct
26 Correct 28 ms 332 KB Output is correct
27 Correct 6 ms 336 KB Output is correct
28 Correct 13 ms 332 KB Output is correct
29 Correct 17 ms 204 KB Output is correct
30 Correct 20 ms 336 KB Output is correct
31 Correct 5 ms 328 KB Output is correct
32 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1585 ms 8324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 8 ms 332 KB Output is correct
24 Correct 9 ms 332 KB Output is correct
25 Correct 27 ms 332 KB Output is correct
26 Correct 28 ms 324 KB Output is correct
27 Correct 6 ms 336 KB Output is correct
28 Correct 13 ms 328 KB Output is correct
29 Correct 16 ms 204 KB Output is correct
30 Correct 21 ms 336 KB Output is correct
31 Correct 4 ms 332 KB Output is correct
32 Correct 3 ms 332 KB Output is correct
33 Execution timed out 1577 ms 8616 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 9 ms 332 KB Output is correct
24 Correct 8 ms 340 KB Output is correct
25 Correct 28 ms 344 KB Output is correct
26 Correct 28 ms 344 KB Output is correct
27 Correct 6 ms 300 KB Output is correct
28 Correct 14 ms 332 KB Output is correct
29 Correct 17 ms 324 KB Output is correct
30 Correct 19 ms 332 KB Output is correct
31 Correct 3 ms 276 KB Output is correct
32 Correct 3 ms 296 KB Output is correct
33 Execution timed out 1572 ms 8488 KB Time limit exceeded
34 Halted 0 ms 0 KB -