제출 #601579

#제출 시각아이디문제언어결과실행 시간메모리
601579Vanilla말 (IOI15_horses)C++17
100 / 100
718 ms67008 KiB
#include <bits/stdc++.h> #include "horses.h" typedef long long int64; using namespace std; const int64 mod = 1e9 + 7; const int maxn = 5e5 + 2; int n; struct node { int64 v; int64 x; int64 y; double dv; double dx; double dy; } sgt [4 * maxn]; node merge (node a, node b) { node rs; b.dx+=a.dx, b.dv+=a.dx; if (a.dv > b.dv) rs.v = a.v, rs.dv = a.dv; else rs.v = a.x * b.v % mod, rs.dv = b.dv; rs.x = a.x * b.x % mod; rs.dx = b.dx; return rs; } node update (int x, int l, int r, int ps, int64 vx, int64 vy) { if (l > ps || r < ps) return sgt[x]; if (l == r && l == ps) { node& nd = sgt[x]; if (vx) nd.dx = log(vx), nd.x = vx; if (vy) nd.dy = log(vy), nd.y = vy; nd.v = nd.x * nd.y % mod, nd.dv = nd.dx + nd.dy; return nd; } int mid = (l + r) / 2; return sgt[x] = merge(update(x * 2, l, mid, ps, vx, vy), update(x * 2 + 1, mid + 1, r, ps, vx, vy)); } 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 sgt[1].v; } int updateX(int pos, int val) { update(1, 0, n - 1, pos, val, 0); return sgt[1].v; } int updateY(int pos, int val) { update(1, 0, n - 1, pos, 0, val); return sgt[1].v; }

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:45:16: warning: conversion from 'int64' {aka 'long long int'} to 'int' may change value [-Wconversion]
   45 |  return sgt[1].v;
      |         ~~~~~~~^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:50:16: warning: conversion from 'int64' {aka 'long long int'} to 'int' may change value [-Wconversion]
   50 |  return sgt[1].v;
      |         ~~~~~~~^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:55:16: warning: conversion from 'int64' {aka 'long long int'} to 'int' may change value [-Wconversion]
   55 |  return sgt[1].v;
      |         ~~~~~~~^
#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...