제출 #91521

#제출 시각아이디문제언어결과실행 시간메모리
91521turbat말 (IOI15_horses)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "horses.h" using namespace std; #define M 500005 long long mod = 1e9 + 7, n, x[M], y[M]; struct segment{ int ans, mul; double a = 0, m = 0; } s[4 * M]; void update(int node, int l, int r, int idx, int valx, int valy){ if (idx < l || r < idx) return; if (l == r){ if (valx) x[l] = valx; if (valy) y[l] = valy; s[node].ans = (1ll * x[l] * y[l]) % mod; s[node].mul = x[l]; s[node].m = log10(x[l]); s[node].a = log(1ll * x[l] * y[l]); return; } int mid = (l + r)/2; update(node * 2, l, mid, idx, int valx, int valy); update(node * 2 + 1, mid + 1, r, idx, int valx, int valy); s[node].m = s[node * 2].m + s[node * 2 + 1].m; s[node].mul = (1ll * s[node * 2].mul * s[node * 2 + 1].mul) % mod; if (s[node * 2].a > s[node * 2 + 1].a + s[node * 2].m){ s[node].ans = s[node * 2].ans; s[node].a = s[node * 2].a; } else{ s[node].ans = (1ll * s[node * 2 + 1].ans * s[node * 2].mul ) % mod; s[node].a = s[node * 2 + 1].a + s[node * 2].m; } } int init(int N, int X[], int Y[]) { n = N; for (int i = 0;i < n;i++) update(1, 0, n - 1, i, X[i], Y[i]); return s[1].ans; } int updateX(int pos, int val) { update(1, 0, n - 1, pos, val, 0); return s[1].ans; } int updateY(int pos, int val) { update(1, 0, n - 1, pos, 0, val); return s[1].ans; }

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

horses.cpp: In function 'void update(int, int, int, int, int, int)':
horses.cpp:15:37: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
   s[node].ans = (1ll * x[l] * y[l]) % mod;
                 ~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:16:20: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
   s[node].mul = x[l];
                 ~~~^
horses.cpp:22:32: error: expected primary-expression before 'int'
  update(node * 2, l, mid, idx, int valx, int valy);
                                ^~~
horses.cpp:22:42: error: expected primary-expression before 'int'
  update(node * 2, l, mid, idx, int valx, int valy);
                                          ^~~
horses.cpp:23:40: error: expected primary-expression before 'int'
  update(node * 2 + 1, mid + 1, r, idx, int valx, int valy);
                                        ^~~
horses.cpp:23:50: error: expected primary-expression before 'int'
  update(node * 2 + 1, mid + 1, r, idx, int valx, int valy);
                                                  ^~~
horses.cpp:25:62: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  s[node].mul = (1ll * s[node * 2].mul * s[node * 2 + 1].mul) % mod;
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:31:64: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
   s[node].ans = (1ll * s[node * 2 + 1].ans * s[node * 2].mul ) % mod;
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:38:18: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
   update(1, 0, n - 1, i, X[i], Y[i]);
                ~~^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:42:17: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  update(1, 0, n - 1, pos, val, 0);
               ~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:46:17: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  update(1, 0, n - 1, pos, 0, val);
               ~~^~~