Submission #348806

#TimeUsernameProblemLanguageResultExecution timeMemory
348806SprdaloHorses (IOI15_horses)C++17
0 / 100
1576 ms8172 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef vector<bool> vb; typedef vector<char> vc; typedef vector<string> vs; typedef vector<pi> vp; typedef vector<pl> vpl; const int mod = 1e9 + 7; void f(ll& x){ if (x >= mod) x %= mod; } ll g(ll x){ f(x); return x; } vi X, Y; int N; int solve(){ ll sol = 0, maxy = 0, s = 1; ll cur = 1; for (int i = 0; i < N; ++i){ s *= X[i]; cur *= X[i]; f(cur); if (s >= maxy){ maxy = Y[i]; sol = g(cur * Y[i]); s = 1; continue; } s *= Y[i]; if (s >= maxy){ maxy = Y[i]; sol = g(cur * Y[i]); s = 1; continue; } } return sol; } int init(int n, int x[], int y[]){ N = n; X = vi(n); Y=vi(n); for (int i = 0; i < n; ++i){ X[i]=x[i]; Y[i] = y[i]; } return solve(); } int updateX(int pos, int val){ X[pos] = val; return solve(); } int updateY(int pos, int val){ Y[pos] = val; return solve(); } /* int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); int n; cin >> n; int x[n]; for (int i = 0; i < n; ++i) cin >> x[i]; int y[n]; for (int i = 0; i < n; ++i) cin >> y[i]; cout << init(n,x,y) << '\n'; int m; cin >> m; for (int i = 0; i < m; ++i){ int type, pos, val; cin >> type >> pos >> val; if (type == 1) cout << updateX(pos, val) << '\n'; else cout << updateY(pos, val) << '\n'; } }*/

Compilation message (stderr)

horses.cpp: In function 'int solve()':
horses.cpp:57:12: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   57 |     return sol;
      |            ^~~
#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...