Submission #133956

#TimeUsernameProblemLanguageResultExecution timeMemory
133956MasterdanHorses (IOI15_horses)C++14
0 / 100
1554 ms10560 KiB
#include "horses.h" #include <bits/stdc++.h> #define MIN 0 #define MAX 1000000007 #define all(a) a.begin (), a.end () #define pb push_back #define mp make_pair #define F first #define S second using namespace std; typedef vector <int> vi; typedef long long int ll; typedef pair <int, int> ii; int maxi =MIN; vi v, v1; int n; int solve(int val1,int val3){ //return 100; if(val1==n-1)return (val3*v1[n-1]); for(int i=0+val1;i<n;i++){ for(int j=0;j<(val3*v[i]);j++){ maxi=max(maxi%MAX,(((val3*v[i])-j)*v1[i]+solve(val1++, (val3*v[i])-j))%MAX); } } return maxi; } int init(int N, int X[], int Y[]) { n=N; for(int i=0;i<n;i++){ v.pb(X[i]); v1.pb(Y[i]); } int t; return t=solve(0, 1); } int updateX(int pos, int val) { return 0; } int updateY(int pos, int val) { return 0; } /* 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() { _inputFile = fopen("horses.in", "rb"); _outputFile = fopen("horses.out", "w"); int N; N = _readInt(); int *X = (int*)malloc(sizeof(int)*(unsigned int)N); int *Y = (int*)malloc(sizeof(int)*(unsigned int)N); for (int i = 0; i < N; i++) { X[i] = _readInt(); } for (int i = 0; i < N; i++) { Y[i] = _readInt(); } fprintf(_outputFile,"%d\n",init(N,X,Y)); int M; M = _readInt(); for (int i = 0; i < M; i++) { int type; type = _readInt(); int pos; pos = _readInt(); int val; val = _readInt(); if (type == 1) { fprintf(_outputFile,"%d\n",updateX(pos,val)); } else if (type == 2) { fprintf(_outputFile,"%d\n",updateY(pos,val)); } } return 0; } */

Compilation message (stderr)

horses.cpp: In function 'int updateX(int, int)':
horses.cpp:37:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateX(int pos, int val) {
                 ^~~
horses.cpp:37:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateX(int pos, int val) {
                          ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:41:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateY(int pos, int val) {
                 ^~~
horses.cpp:41:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateY(int pos, int val) {
                          ^~~
#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...