Submission #1053783

# Submission time Handle Problem Language Result Execution time Memory
1053783 2024-08-11T17:32:29 Z Osplei Horses (IOI15_horses) C++17
Compilation error
0 ms 0 KB
#include "horses.h"
#include <bits/stdc++.h>

typedef long long ll;
typedef pair <ll, ll> LL;

#define F first
#define S second

ll mod = 1e9 + 7;

ll init(ll N, ll X[], ll Y[]) {
  //pos ans  tengo
  queue <pair <ll, LL>> q;
  ll ans = 0;

  q.push({-1, {0, 1}});

  while (!q.empty()) {
    pair <ll, LL> act;
    act = q.front();
    ans = max(ans, act.S.F);
    q.pop();

    q.push({act.F + 1, {act.S.F % mod, (act.S.S * X[act.F + 1]) % mod}});
    q.push({act.F + 1, {((act.S.F % mod) + (((((act.S.S * X[act.F + 1]) % mod) - 1) * Y[act.F + 1]) % mod)) % mod, 1LL}});
    q.push({act.F + 1, {((act.S.F % mod) + ((((act.S.S * X[act.F + 1]) % mod) * Y[act.F + 1]) % mod)) % mod, 0LL}});
  }

	return ans % mod;
}

int updateX(int pos, int val) {	
	return 0;
}

int updateY(int pos, int val) {
	return 0;
}

Compilation message

horses.cpp:5:9: error: 'pair' does not name a type
    5 | typedef pair <ll, ll> LL;
      |         ^~~~
horses.cpp: In function 'll init(ll, ll*, ll*)':
horses.cpp:14:3: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
   14 |   queue <pair <ll, LL>> q;
      |   ^~~~~
      |   std::queue
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from horses.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:96:11: note: 'std::queue' declared here
   96 |     class queue
      |           ^~~~~
horses.cpp:14:10: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   14 |   queue <pair <ll, LL>> q;
      |          ^~~~
      |          std::pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from horses.cpp:2:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
horses.cpp:14:18: error: expected primary-expression before ',' token
   14 |   queue <pair <ll, LL>> q;
      |                  ^
horses.cpp:14:20: error: 'LL' was not declared in this scope
   14 |   queue <pair <ll, LL>> q;
      |                    ^~
horses.cpp:14:25: error: 'q' was not declared in this scope
   14 |   queue <pair <ll, LL>> q;
      |                         ^
horses.cpp:20:13: error: expected primary-expression before ',' token
   20 |     pair <ll, LL> act;
      |             ^
horses.cpp:20:19: error: 'act' was not declared in this scope
   20 |     pair <ll, LL> act;
      |                   ^~~
horses.cpp:22:11: error: 'max' was not declared in this scope; did you mean 'std::max'?
   22 |     ans = max(ans, act.S.F);
      |           ^~~
      |           std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from horses.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
horses.cpp:12:12: warning: unused parameter 'N' [-Wunused-parameter]
   12 | ll init(ll N, ll X[], ll Y[]) {
      |         ~~~^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:33:17: warning: unused parameter 'pos' [-Wunused-parameter]
   33 | int updateX(int pos, int val) {
      |             ~~~~^~~
horses.cpp:33:26: warning: unused parameter 'val' [-Wunused-parameter]
   33 | int updateX(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:37:17: warning: unused parameter 'pos' [-Wunused-parameter]
   37 | int updateY(int pos, int val) {
      |             ~~~~^~~
horses.cpp:37:26: warning: unused parameter 'val' [-Wunused-parameter]
   37 | int updateY(int pos, int val) {
      |                      ~~~~^~~