Submission #235371

# Submission time Handle Problem Language Result Execution time Memory
235371 2020-05-28T07:25:38 Z crossing0ver Game (IOI13_game) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#define ll long long
#include "game.h"
using namespace std;

long long gcd2(long long X, long long Y) {
    long long tmp;
    while (X != Y && Y != 0) {
        tmp = X;
        X = Y;
        Y = tmp % Y;
    }
    return X;
}
ll t[100][4*100001];
ll t1[2000][4*2001];
int pos,l,r,sd,R,C;
ll val;
void upd (int v,int tl,int tr) {
	if (tl == tr) {
		t[sd][v] = val;
		return;
	}
	int tm = (tl + tr)/2;
	if (pos <= tm) upd(v*2,tl,tm);
	else upd(v*2|1,tm+1,tr);
	t[sd][v] = gcd2(t[sd][v*2],t[sd][v*2|1]);
}
void upd1 (int v,int tl,int tr) {
	if (tl == tr) {
		t1[sd][v] = val;
		return;
	}
	int tm = (tl + tr)/2;
	if (pos <= tm) upd1(v*2,tl,tm);
	else upd1(v*2|1,tm+1,tr);
	t1[sd][v] = gcd2(t1[sd][v*2],t1[sd][v*2|1]);
}
ll get (int v,int tl,int tr) {
	if (l > tr || r < tl) return 0;
	if (l <= tl && r >= tr) {
		return t[sd][v];
	}
	int tm = (tl + tr)/2;
	return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
}
ll get1 (int v,int tl,int tr) {
	if (l > tr || r < tl) return 0;
	if (l <= tl && r >= tr) {
		return t1[sd][v];
	}
	int tm = (tl + tr)/2;
	return gcd2 ( get1 (v*2,tl,tm), get1 (v*2|1,tm+1,tr));
}
void update(int P, int Q, long long K) {
	sd = P;
	val = K; pos = Q;
	if (C > 2000 || R > 2000)
	upd (1,0,100000);
	else  upd1 (1,0,2000);
}
ll s;
long long calculate(int P, int Q, int U, int V) {
    s = 0;
    l = Q; r = V;
    if (C > 2000 || R > 2000)
    for (sd = P; sd <= U; sd++) {
    	
    	s = gcd2(s,get (1,0,100000));
    else 
    	for (sd = P; i <= U; i++)
			s = gcd2(s,get1 (1,0,2000));	
	}
	return s;
}

void init(int R1, int C1) {R = R1; C = C1;}

Compilation message

grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
game.cpp: In function 'long long int get(int, int, int)':
game.cpp:45:37: error: no matching function for call to 'get(int&, int, int&, int&, int&, int&)'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
game.cpp:39:4: note: candidate: long long int get(int, int, int)
 ll get (int v,int tl,int tr) {
    ^~~
game.cpp:39:4: note:   candidate expects 3 arguments, 6 provided
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1361:5: note: candidate: template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Types...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1361:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1355:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Types...>&& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1355:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1349:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Types...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1349:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1326:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1320:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1314:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/include/c++/7/array:324:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^~~
/usr/include/c++/7/array:316:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::array<_Tp, _Nm>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/include/c++/7/array:307:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::array<_Tp, _Nm>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:273:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&)
     get(pair<_Up, _Tp>&& __p) noexcept
     ^~~
/usr/include/c++/7/utility:273:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::pair<_Up, _Tp>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:268:5: note: candidate: template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&)
     get(const pair<_Up, _Tp>& __p) noexcept
     ^~~
/usr/include/c++/7/utility:268:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:263:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&)
     get(pair<_Up, _Tp>& __p) noexcept
     ^~~
/usr/include/c++/7/utility:263:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::pair<_Up, _Tp>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:258:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&)
     get(pair<_Tp, _Up>&& __p) noexcept
     ^~~
/usr/include/c++/7/utility:258:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:253:5: note: candidate: template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&)
     get(const pair<_Tp, _Up>& __p) noexcept
     ^~~
/usr/include/c++/7/utility:253:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:248:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&)
     get(pair<_Tp, _Up>& __p) noexcept
     ^~~
/usr/include/c++/7/utility:248:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:239:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/include/c++/7/utility:239:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:234:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^~~
/usr/include/c++/7/utility:234:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/7/utility:229:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/include/c++/7/utility:229:5: note:   template argument deduction/substitution failed:
game.cpp:45:37: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                     ^
game.cpp:45:65: error: no matching function for call to 'get(int&, int, int, int&, int&, int&)'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                                                 ^
game.cpp:39:4: note: candidate: long long int get(int, int, int)
 ll get (int v,int tl,int tr) {
    ^~~
game.cpp:39:4: note:   candidate expects 3 arguments, 6 provided
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1361:5: note: candidate: template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Types...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1361:5: note:   template argument deduction/substitution failed:
game.cpp:45:65: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                                                 ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1355:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Types...>&& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1355:5: note:   template argument deduction/substitution failed:
game.cpp:45:65: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                                                 ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1349:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Types...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1349:5: note:   template argument deduction/substitution failed:
game.cpp:45:65: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                                                 ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1326:5: note:   template argument deduction/substitution failed:
game.cpp:45:65: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                                                 ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1320:5: note:   template argument deduction/substitution failed:
game.cpp:45:65: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                                                 ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1314:5: note:   template argument deduction/substitution failed:
game.cpp:45:65: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                                                 ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from game.cpp:1:
/usr/include/c++/7/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/include/c++/7/array:324:5: note:   template argument deduction/substitution failed:
game.cpp:45:65: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'int'
  return gcd2 ( get (sd,v*2,tl,tm,l,r), get (sd,v*2|1,tm+1,tr,l,r));
                                                                 ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,