Submission #231811

#TimeUsernameProblemLanguageResultExecution timeMemory
231811MasterdanHorses (IOI15_horses)C++14
17 / 100
19 ms8448 KiB
#include "horses.h" #include <bits/stdc++.h> #define MIN -1 #define MAX 1e9+7 #define all(a) a.begin (), a.end () #define pb push_back #define mp make_pair #define F first #define S second #define mem(a, c) memset(a, c, sizeof(a)) using namespace std; typedef vector <int> vi; typedef long long int ll; typedef pair <int, int> ii; typedef vector <ll> vll; int n; ll lol=MAX; ll vx[2010], vy[2010]; ll solve(){ /* for(int i=0;i<n;i++)cout<<vx[i]<<" "; cout<<endl; for(int i=0;i<n;i++)cout<<vy[i]<<" "; cout<<endl;*/ ll acum=1; ll maxi=MIN; for(int i=0;i<n;i++){ acum=((acum%lol)*(vx[i]%lol))%lol; acum=acum%lol; ll aux=((acum%lol)*(vy[i]%lol))%lol; maxi=max(maxi, aux); } return maxi; } int init(int N, int x[], int y[]) { n=N; for(int i=0;i<n;i++){ vx[i]=ll(x[i]); vy[i]=ll(y[i]); } return solve(); } int updateX(int pos, int val) { vx[pos]=ll(val); return solve(); } int updateY(int pos, int val) { vy[pos]=ll(val); return solve(); } /* static char _buffer[1024]; static int _currentChar = 0; static int _charsNumber = 0; static FILE *_inputFile, *_outputFile; static inline int _read() { if (_charsNumber < 0) { exit(1); } if (!_charsNumber || _currentChar == _charsNumber) { _charsNumber = (int)fread(_buffer, sizeof(_buffer[0]), sizeof(_buffer), _inputFile); _currentChar = 0; } if (_charsNumber <= 0) { return -1; } return _buffer[_currentChar++]; } static inline int _readInt() { int c, x, s; c = _read(); while (c <= 32) c = _read(); x = 0; s = 1; if (c == '-') { s = -1; c = _read(); } while (c > 32) { x *= 10; x += c - '0'; c = _read(); } if (s < 0) x = -x; return x; } int main() { int n; cin>>n; int X[n], Y[n]; for(int i=0;i<n;i++){ int x; cin>>X[i]; } for(int i=0;i<n;i++){ int y; cin>>Y[i]; } //fprintf(_outputFile,"%d\n",init(n,X,Y)); cout<<init(n, X, Y)<<endl; int m; cin>>m; for(int i=1;i<=m;i++){ int x, pos, val; cin>>x>>pos>>val; if(x==1){ cout<<updateX(pos, val)<<endl; }else cout<<updateY(pos, val)<<endl; } return 0; } */

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:40:17: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
     return solve();
            ~~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:45:14: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return solve();
         ~~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:50:14: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return solve();
         ~~~~~^~
#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...