# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152841 | 2019-09-10T00:38:10 Z | jhnah917 | Game (IOI13_game) | C++14 | Compilation error |
0 ms | 0 KB |
#ifndef __GAME_H__ #define __GAME_H__ #ifdef __cplusplus extern "C" { #endif #include <math.h> #include <stdio.h> #include <bits/stdc++.h> using namespace std; void init(int R, int C); void update(int P, int Q, long long K); long long calculate(int P, int Q, int U, int V); int R, C; long long f(long long X, long long Y) { long long tmp; while (X != Y && Y != 0) { tmp = X; X = Y; Y = tmp % Y; } return X; } typedef long long ll; struct Seg1d{ ll tree[8080]; int bias; void init(int n){ for(bias=1; bias<=n; bias <<= 1); } void update(int x, ll v){ x |= bias; tree[x] = v; while(x >>= 1){ tree[x] = f(tree[x << 1], tree[x << 1 | 1]); } } ll query(ll l, ll r){ l |= bias, r |= bias; ll ret = 0; while(l <= r){ if(l & 1) ret = f(ret, tree[l++]); if(~r & 1) ret = f(ret, tree[r--]); l >>= 1, r >>= 1; } return ret; } }; struct Seg2d{ Seg1d tree[8080]; int bias; void init(int n, int m){ for(bias=1; bias<=n; bias<<=1); for(int i=0; i<bias*2; i++) tree[i].init(m); } void update(int x, int y, ll v){ x |= bias; tree[x].update(y, v); while(x >>= 1){ ll t1 = tree[x << 1].query(y, y); ll t2 = tree[x << 1 | 1 ].query(y, y); tree[x].update(y, f(t1, t2)); } } ll query(ll l, ll r, ll l1, ll r1){ l |= bias, r |= bias; ll ret = 0; while(l <= r){ if(l & 1) tree[l++].query(l1, r1); if(~r & 1) tree[r--].query(l1, r1); l >>=1 ,r >>= 1; } return ret; } }tree; void init(int r, int c) { R = r, C = c; } void update(int x, int y, long long val) { tree.update(x, y, val); } long long calculate(int x1, int y1, int x2, int y2) { return tree.query(x1, x2, y1, y2); } #ifdef __cplusplus } #endif #endif /* __GAME_H__ */
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; ^~~ In file included from /usr/include/c++/7/utility:69:0, from /usr/include/c++/7/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from game.cpp:10: /usr/include/c++/7/bits/stl_relops.h:85:5: error: template with C linkage template <class _Tp> ^~~~~~~~ /usr/include/c++/7/bits/stl_relops.h:98:5: error: template with C linkage template <class _Tp> ^~~~~~~~ /usr/include/c++/7/bits/stl_relops.h:111:5: error: template with C linkage template <class _Tp> ^~~~~~~~ /usr/include/c++/7/bits/stl_relops.h:124:5: error: template with C linkage template <class _Tp> ^~~~~~~~ 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:10: /usr/include/c++/7/utility:87:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:94:3: error: template with C linkage template<typename _Tp, typename = void> ^~~~~~~~ /usr/include/c++/7/utility:97:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:103:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:106:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:109:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:132:3: error: template with C linkage template<std::size_t __i, typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:136:3: error: template with C linkage template<std::size_t __i, typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:139:3: error: template with C linkage template<std::size_t __i, typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:145:3: error: template with C linkage template<std::size_t __i, typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:151:3: error: template with C linkage template<std::size_t __i, typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:160:3: error: template with C linkage template<std::size_t __i, typename _Tp> ^~~~~~~~ /usr/include/c++/7/utility:167:3: error: template with C linkage template<typename _T1, typename _T2> ^~~~~~~~ /usr/include/c++/7/utility:172:3: error: template with C linkage template<class _Tp1, class _Tp2> ^~~~~~~~ /usr/include/c++/7/utility:177:3: error: template with C linkage template<class _Tp1, class _Tp2> ^~~~~~~~ /usr/include/c++/7/utility:182:3: error: template with C linkage template<class _Tp1, class _Tp2> ^~~~~~~~ /usr/include/c++/7/utility:186:3: error: template with C linkage template<std::size_t _Int> ^~~~~~~~ /usr/include/c++/7/utility:189:3: error: template specialization with C linkage template<> ^~~~~~~~ /usr/include/c++/7/utility:208:3: error: template specialization with C linkage template<> ^~~~~~~~ /usr/include/c++/7/utility:227:3: error: template with C linkage template<std::size_t _Int, class _Tp1, class _Tp2> ^~~~~~~~ /usr/include/c++/7/utility:232:3: error: template with C linkage template<std::size_t _Int, class _Tp1, class _Tp2> ^~~~~~~~ /usr/include/c++/7/utility:237:3: error: template with C linkage template<std::size_t _Int, class _Tp1, class _Tp2> ^~~~~~~~ /usr/include/c++/7/utility:246:3: error: template with C linkage template <typename _Tp, typename _Up> ^~~~~~~~ /usr/include/c++/7/utility:251:3: error: template with C linkage template <typename _Tp, typename _Up> ^~~~~~~~ /usr/include/c++/7/utility:256:3: error: template with C linkage template <typename _Tp, typename _Up> ^~~~~~~~ /usr/include/c++/7/utility:261:3: error: template with C linkage template <typename _Tp, typename _Up> ^~~~~~~~ /usr/include/c++/7/utility:266:3: error: template with C linkage template <typename _Tp, typename _Up> ^~~~~~~~ /usr/include/c++/7/utility:271:3: error: template with C linkage template <typename _Tp, typename _Up> ^~~~~~~~ /usr/include/c++/7/utility:279:3: error: template with C linkage template <typename _Tp, typename _Up = _Tp> ^~~~~~~~ /usr/include/c++/7/utility:287:3: error: template with C linkage template<size_t... _Indexes> struct _Index_tuple { }; ^~~~~~~~ /usr/include/c++/7/utility:290:3: error: template with C linkage template<typename _Itup1, typename _Itup2> struct _Itup_cat; ^~~~~~~~ /usr/include/c++/7/utility:292:3: error: template with C linkage template<size_t... _Ind1, size_t... _Ind2> ^~~~~~~~ /usr/include/c++/7/utility:299:3: error: template with C linkage template<size_t _Num> ^~~~~~~~ /usr/include/c++/7/utility:305:3: error: template specialization with C linkage template<> ^~~~~~~~ /usr/include/c++/7/utility:311:3: error: template specialization with C linkage template<> ^~~~~~~~ /usr/include/c++/7/utility:322:3: error: template with C linkage template<typename _Tp, _Tp... _Idx> ^~~~~~~~ /usr/include/c++/7/utility:329:3: error: template with C linkage template<typename _Tp, _Tp _Num, ^~~~~~~~ /usr/include/c++/7/utility:333:3: error: template with C linkage template<typename _Tp, _Tp _Num, size_t... _Idx> ^~~~~~~~ /usr/include/c++/7/utility:343:3: error: template with C linkage template<typename _Tp, _Tp _Num> ^~~~~~~~ /usr/include/c++/7/utility:348:3: error: template with C linkage template<size_t... _Idx> ^~~~~~~~ /usr/include/c++/7/utility:352:3: error: template with C linkage template<size_t _Num> ^~~~~~~~ /usr/include/c++/7/utility:356:3: error: template with C linkage template<typename... _Types> ^~~~~~~~ In file included from /usr/include/c++/7/bits/stl_algo.h:60:0, from /usr/include/c++/7/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from game.cpp:10: /usr/include/c++/7/bits/algorithmfwd.h:195:3: error: template with C linkage template<typename _IIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:199:3: error: template with C linkage template<typename _IIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:204:3: error: template with C linkage template<typename _FIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:208:3: error: template with C linkage template<typename _FIter, typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:224:3: error: template with C linkage template<typename _IIter, typename _OIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:228:3: error: template with C linkage template<typename _BIter1, typename _BIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:233:3: error: template with C linkage template<typename _IIter, typename _OIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:237:3: error: template with C linkage template<typename _IIter, typename _Size, typename _OIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:245:3: error: template with C linkage template<typename _FIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:249:3: error: template with C linkage template<typename _FIter, typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:253:3: error: template with C linkage template<typename _FIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:257:3: error: template with C linkage template<typename _OIter, typename _Size, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:263:3: error: template with C linkage template<typename _FIter1, typename _FIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:267:3: error: template with C linkage template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:275:3: error: template with C linkage template<typename _IIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:284:3: error: template with C linkage template<typename _IIter1, typename _IIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:288:3: error: template with C linkage template<typename _IIter1, typename _IIter2, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:292:3: error: template with C linkage template<typename _BIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:296:3: error: template with C linkage template<typename _BIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:301:3: error: template with C linkage template<typename _RAIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:305:3: error: template with C linkage template<typename _RAIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:309:3: error: template with C linkage template<typename _RAIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:313:3: error: template with C linkage template<typename _RAIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:317:3: error: template with C linkage template<typename _IIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:321:3: error: template with C linkage template<typename _FIter1, typename _FIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:325:3: error: template with C linkage template<typename _FIter1, typename _FIter2, ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:330:3: error: template with C linkage template<typename _FIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:334:3: error: template with C linkage template<typename _FIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:338:3: error: template with C linkage template<typename _FIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:342:3: error: template with C linkage template<typename _FIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:347:3: error: template with C linkage template<typename _FIter1, typename _FIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:351:3: error: template with C linkage template<typename _FIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:355:3: error: template with C linkage template<typename _FIter, typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:359:3: error: template with C linkage template<typename _RAIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:363:3: error: template with C linkage template<typename _RAIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:367:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:372:3: error: template with C linkage template<typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:380:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:385:3: error: template with C linkage template<typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:393:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:398:3: error: template with C linkage template<typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:403:3: error: template with C linkage template<typename _FIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:408:3: error: template with C linkage template<typename _FIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:413:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:418:3: error: template with C linkage template<typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:423:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:428:3: error: template with C linkage template<typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:433:3: error: template with C linkage template<typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:438:3: error: template with C linkage template<typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:446:3: error: template with C linkage template<typename _BIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:450:3: error: template with C linkage template<typename _BIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:455:3: error: template with C linkage template<typename _IIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:463:3: error: template with C linkage template<typename _IIter, typename _RAIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:467:3: error: template with C linkage template<typename _IIter, typename _RAIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:474:3: error: template with C linkage template<typename _IIter, typename _OIter1, ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:479:3: error: template with C linkage template<typename _FIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:484:3: error: template with C linkage template<typename _RAIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:488:3: error: template with C linkage template<typename _RAIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:492:3: error: template with C linkage template<typename _BIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:496:3: error: template with C linkage template<typename _BIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:500:3: error: template with C linkage template<typename _RAIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:504:3: error: template with C linkage template<typename _RAIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:510:3: error: template with C linkage template<typename _FIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:514:3: error: template with C linkage template<typename _FIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:518:3: error: template with C linkage template<typename _IIter, typename _OIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:522:3: error: template with C linkage template<typename _IIter, typename _OIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:528:3: error: template with C linkage template<typename _IIter, typename _OIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:532:3: error: template with C linkage template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:538:3: error: template with C linkage template<typename _BIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:542:3: error: template with C linkage template<typename _BIter, typename _OIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:548:5: error: template with C linkage template<typename _FIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:553:3: error: template with C linkage template<typename _FIter, typename _OIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:565:3: error: template with C linkage template<typename _RAIter, typename _UGenerator> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:570:3: error: template with C linkage template<typename _RAIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:574:3: error: template with C linkage template<typename _RAIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:578:3: error: template with C linkage template<typename _BIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:594:3: error: template with C linkage template<typename _FIter1, typename _FIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:600:3: error: template with C linkage template<typename _FIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:604:3: error: template with C linkage template<typename _FIter, typename _BinaryPredicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:610:3: error: template with C linkage template<typename _FIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:614:3: error: template with C linkage template<typename _FIter, typename _Tp, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:622:3: error: template with C linkage template<typename _FIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:626:3: error: template with C linkage template<typename _FIter, typename _BinaryPredicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:630:3: error: template with C linkage template<typename _IIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:634:3: error: template with C linkage template<typename _IIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:638:3: error: template with C linkage template<typename _IIter1, typename _IIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:642:3: error: template with C linkage template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:646:3: error: template with C linkage template<typename _IIter, typename _Tp> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:650:3: error: template with C linkage template<typename _FIter1, typename _FIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:654:3: error: template with C linkage template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:658:3: error: template with C linkage template<typename _IIter, typename _Predicate> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:662:3: error: template with C linkage template<typename _IIter, typename _Funct> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:666:3: error: template with C linkage template<typename _FIter, typename _Generator> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:670:3: error: template with C linkage template<typename _OIter, typename _Size, typename _Generator> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:674:3: error: template with C linkage template<typename _IIter1, typename _IIter2> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:678:3: error: template with C linkage template<typename _IIter1, typename _IIter2, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:682:3: error: template with C linkage template<typename _FIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:687:3: error: template with C linkage template<typename _FIter, typename _Compare> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:692:3: error: template with C linkage template<typename _IIter1, typename _IIter2, typename _OIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:696:3: error: template with C linkage template<typename _IIter1, typename _IIter2, typename _OIter, ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:701:3: error: template with C linkage template<typename _FIter> ^~~~~~~~ /usr/include/c++/7/bits/algorithmfwd.h:706:3: error: template