# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
865271 | vjudge1 | Meteors (POI11_met) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
(( `'-""``""-'` ))
)-__-_.._-__-(
/ --- (o _ o) --- \
\ .-* ( .0. ) *-. /
_'-. ,_ '=' _, .-'_
/ `;#'#'# - #'#'#;` \
\_)) -----'#'----- ((_/
# --------- #
'# ------- #'
/..-'# ------- #'-.\
_\...-\'# -- #'/-.../_
((____)- '#' -(____))
art by - Vinni01 / luchi abi
cout << fixed << setprecision(6) << x;
freopen ( "sum.in", "r", stdin )
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <unordered_map>
using namespace std ;
#define ll int
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define UseOFF ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)
#define sz size
#define ins insert
#define new jweijofdg
const ll N = 3e5 + 111 ;
const ll k = 400 ;
ll sum[ N ] ;
ll a[ N ] ;
ll p[ N ] ;
map < ll, ll > cnt[ N ] ;
map < ll, ll > ANS[ N ] ;
signed main()
{
UseOFF ;
ll n, m ;
cin >> n >> m ;
for( int i = 1 ; i <= m ; i++ )
{
cin >> a[ i ] ;
}
for( int i = 1 ; i <= n ; i++ ) { cin >> p[ i ] ; ANS[ i ] = 1e9 ; }
ll q ;
cin >> q ;
for( int i = 1 ; i <= q ; i++ )
{
ll l, r, x ;
cin >> l >> r >> x ;
ll r2 = r ;
if( l > r )
{
r = m ;
}
for( int j = l ; j <= r ; j++ )
{
cnt[ a[ j ] ] += x ;
//if( a[ j ] == 3 )cout << cnt[ a[ j ] ] << " " << p[ a[ j ] ] << " " << a[ j ] << " " << i << " " << x << '\n' ;
if( cnt[ a[ j ] ] >= p[ a[ j ] ] )
{
ANS[ a[ j ] ] = min( ANS[ a[ j ] ], i ) ;
}
}
if( l > r2 )
{
for( int j = 1 ; j <= r2 ; j++ )
{
cnt[ a[ j ] ] += x ;
//if( a[ j ] == 3 )cout << cnt[ a[ j ] ] << " " << p[ a[ j ] ] << " " << a[ j ] << " " << i << " " << x << '\n' ;
if( cnt[ a[ j ] ] >= p[ a[ j ] ] )
{
ANS[ a[ j ] ] = min( ANS[ a[ j ] ], i ) ;
}
}
}
}
for( int i = 1 ; i <= n ; i++ )
{
if( ANS[ i ] == 1e9 ) { cout << "NIE\n" ; continue ; }
cout << ANS[ i ] << '\n' ;
}
}
Compilation message (stderr)
met.cpp:21: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas] 21 | #pragma GCC optimization("unroll-loops") | met.cpp: In function 'int main()': met.cpp:74:66: error: no match for 'operator=' (operand types are 'std::map<int, int>' and 'double') 74 | for( int i = 1 ; i <= n ; i++ ) { cin >> p[ i ] ; ANS[ i ] = 1e9 ; } | ^~~ In file included from /usr/include/c++/10/map:61, from met.cpp:22: /usr/include/c++/10/bits/stl_map.h:319:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>& std::map<_Key, _Tp, _Compare, _Alloc>::operator=(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]' 319 | operator=(const map&) = default; | ^~~~~~~~ /usr/include/c++/10/bits/stl_map.h:319:17: note: no known conversion for argument 1 from 'double' to 'const std::map<int, int>&' 319 | operator=(const map&) = default; | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_map.h:323:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>& std::map<_Key, _Tp, _Compare, _Alloc>::operator=(std::map<_Key, _Tp, _Compare, _Alloc>&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]' 323 | operator=(map&&) = default; | ^~~~~~~~ /usr/include/c++/10/bits/stl_map.h:323:17: note: no known conversion for argument 1 from 'double' to 'std::map<int, int>&&' 323 | operator=(map&&) = default; | ^~~~~ /usr/include/c++/10/bits/stl_map.h:337:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>& std::map<_Key, _Tp, _Compare, _Alloc>::operator=(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]' 337 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/10/bits/stl_map.h:337:46: note: no known conversion for argument 1 from 'double' to 'std::initializer_list<std::pair<const int, int> >' 337 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ met.cpp:89:21: error: no match for 'operator+=' (operand types are 'std::map<int, int>' and 'int') 89 | cnt[ a[ j ] ] += x ; | ~~~~~~~~~~~~~~^~~~ met.cpp:91:25: error: no match for 'operator>=' (operand types are 'std::map<int, int>' and 'int') 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ~~~~~~~~~~~~~ ^~ ~~~~~~~~~~~ | | | | | int | std::map<int, int> In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/stl_tree.h:63, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/bits/stl_pair.h:514:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)' 514 | operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:514:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::pair<_T1, _T2>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/stl_tree.h:63, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/bits/stl_iterator.h:390:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)' 390 | operator>=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:390:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/stl_tree.h:63, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/bits/stl_iterator.h:428:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)' 428 | operator>=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:428:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/stl_tree.h:63, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/bits/stl_iterator.h:1478:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)' 1478 | operator>=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:1478:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::move_iterator<_IteratorL>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/stl_tree.h:63, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/bits/stl_iterator.h:1525:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)' 1525 | operator>=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:1525:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::move_iterator<_IteratorL>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/stl_tree.h:72, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/optional:1027:5: note: candidate: 'template<class _Tp, class _Up> constexpr std::__optional_relop_t<decltype ((declval<_Tp>() >= declval<_Up>()))> std::operator>=(const std::optional<_Tp>&, const std::optional<_Up>&)' 1027 | operator>=(const optional<_Tp>& __lhs, const optional<_Up>& __rhs) | ^~~~~~~~ /usr/include/c++/10/optional:1027:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::optional<_Tp>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/stl_tree.h:72, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/optional:1101:5: note: candidate: 'template<class _Tp> constexpr bool std::operator>=(const std::optional<_Tp>&, std::nullopt_t)' 1101 | operator>=(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept | ^~~~~~~~ /usr/include/c++/10/optional:1101:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::optional<_Tp>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/stl_tree.h:72, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/optional:1106:5: note: candidate: 'template<class _Tp> constexpr bool std::operator>=(std::nullopt_t, const std::optional<_Tp>&)' 1106 | operator>=(nullopt_t, const optional<_Tp>& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/10/optional:1106:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: mismatched types 'const std::optional<_Tp>' and 'int' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/stl_tree.h:72, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/optional:1173:5: note: candidate: 'template<class _Tp, class _Up> constexpr std::__optional_relop_t<decltype ((declval<_Tp>() >= declval<_Up>()))> std::operator>=(const std::optional<_Tp>&, const _Up&)' 1173 | operator>=(const optional<_Tp>& __lhs, const _Up& __rhs) | ^~~~~~~~ /usr/include/c++/10/optional:1173:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::optional<_Tp>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/stl_tree.h:72, from /usr/include/c++/10/map:60, from met.cpp:22: /usr/include/c++/10/optional:1179:5: note: candidate: 'template<class _Tp, class _Up> constexpr std::__optional_relop_t<decltype ((declval<_Up>() >= declval<_Tp>()))> std::operator>=(const _Up&, const std::optional<_Tp>&)' 1179 | operator>=(const _Up& __lhs, const optional<_Tp>& __rhs) | ^~~~~~~~ /usr/include/c++/10/optional:1179:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: mismatched types 'const std::optional<_Tp>' and 'int' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/tuple:39, from /usr/include/c++/10/bits/stl_map.h:63, from /usr/include/c++/10/map:61, from met.cpp:22: /usr/include/c++/10/array:305:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bool std::operator>=(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)' 305 | operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) | ^~~~~~~~ /usr/include/c++/10/array:305:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::array<_Tp, _Nm>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/bits/stl_map.h:63, from /usr/include/c++/10/map:61, from met.cpp:22: /usr/include/c++/10/tuple:1466:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>=(const std::tuple<_Tps ...>&, const std::tuple<_Args2 ...>&)' 1466 | operator>=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/10/tuple:1466:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::tuple<_Tps ...>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/map:61, from met.cpp:22: /usr/include/c++/10/bits/stl_map.h:1529:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>=(const std::map<_Key, _Tp, _Compare, _Allocator>&, const std::map<_Key, _Tp, _Compare, _Allocator>&)' 1529 | operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_map.h:1529:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: mismatched types 'const std::map<_Key, _Tp, _Compare, _Allocator>' and 'int' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/map:62, from met.cpp:22: /usr/include/c++/10/bits/stl_multimap.h:1194:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>=(const std::multimap<_Key, _Tp, _Compare, _Allocator>&, const std::multimap<_Key, _Tp, _Compare, _Allocator>&)' 1194 | operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_multimap.h:1194:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::multimap<_Key, _Tp, _Compare, _Allocator>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/set:61, from met.cpp:23: /usr/include/c++/10/bits/stl_set.h:1051:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator>=(const std::set<_Key, _Compare, _Allocator>&, const std::set<_Key, _Compare, _Allocator>&)' 1051 | operator>=(const set<_Key, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_set.h:1051:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::set<_Key, _Compare, _Allocator>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/set:62, from met.cpp:23: /usr/include/c++/10/bits/stl_multiset.h:1037:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator>=(const std::multiset<_Key, _Compare, _Allocator>&, const std::multiset<_Key, _Compare, _Allocator>&)' 1037 | operator>=(const multiset<_Key, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_multiset.h:1037:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::multiset<_Key, _Compare, _Allocator>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/list:63, from met.cpp:24: /usr/include/c++/10/bits/stl_list.h:2075:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&)' 2075 | operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_list.h:2075:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::__cxx11::list<_Tp, _Alloc>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/deque:67, from met.cpp:27: /usr/include/c++/10/bits/stl_deque.h:2304:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const std::deque<_Tp, _Alloc>&, const std::deque<_Tp, _Alloc>&)' 2304 | operator>=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_deque.h:2304:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::deque<_Tp, _Alloc>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/vector:67, from /usr/include/c++/10/queue:61, from met.cpp:28: /usr/include/c++/10/bits/stl_vector.h:1955:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)' 1955 | operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:1955:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::vector<_Tp, _Alloc>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/queue:64, from met.cpp:28: /usr/include/c++/10/bits/stl_queue.h:386:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>=(const std::queue<_Tp, _Seq>&, const std::queue<_Tp, _Seq>&)' 386 | operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:386:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::queue<_Tp, _Seq>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) | ^ In file included from /usr/include/c++/10/stack:61, from met.cpp:29: /usr/include/c++/10/bits/stl_stack.h:361:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>=(const std::stack<_Tp, _Seq>&, const std::stack<_Tp, _Seq>&)' 361 | operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_stack.h:361:5: note: template argument deduction/substitution failed: met.cpp:91:38: note: 'std::map<int, int>' is not derived from 'const std::stack<_Tp, _Seq>' 91 | if( cnt[ a[ j ] ] >= p[ a[ j ] ] ) |