답안 #496478

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496478 2021-12-21T10:37:31 Z AQ0212 Meteors (POI11_met) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <sstream>
#include <cstring>

#define ll long long int
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define all(x) x.begin(), x.end()

using namespace std;

ll l, r, a, p[ 500111 ], o[ 500111 ], cnt[ 500111 ], ans[ 500111 ];
vector < ll > v[ 500111 ];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(false); cout.tie(false);
    
    ll n, m, k;

    cin >> n >> m;

    for(int i = 1; i <= m; i ++){
        cin >> o[ i ];
        v[ o[ i ] ].pb(i);
    }
    for(int i = 1; i <= n; i ++){
        cin >> p[ i ];
    }

    cin >> k;
    ll t = 1;
    while(k --){
        cin >> l >> r >> a;

        if(l <= r){
            for(int i = 1; i <= m; i ++){
                for(int j = 0; j < v[ i ].size(); j ++){
                    if(l <= v[ i ][ j ] && v[ i ][ j ] <= r)
                        cnt[ i ] += a;
                }
                if(cnt[ i ] >= p[ i ] && !ans[ i ])
                    ans[ i ] = t;
            }
        }else{
            for(int i = 1; i <= m; i ++){
                for(int j = 0; j < v[ i ].size(); j ++){
                    if(l <= v[ i ][ j ] || v[ i ][ j ] <= r)
                        cnt[ i ] += a;
                }
                if(cnt[ i ] >= p[ i ] && !ans[ i ])
                    ans[ i ] = t;
            }
        }

        t ++;
    }

    for(int i = 1; i <= n; i ++){
        if(ans[ i ])
            cout << ans[ i ] << "\n";
        else
            cout << "NIE\n";
    }

    // for(int i = 1; i <= n; i ++){
    //     cout << i << ":" << cnt[ i ] << "\n";
    // }
}


Compilation message

met.cpp: In function 'int main()':
met.cpp:25:18: error: no matching function for call to 'std::basic_istream<char>::tie(bool)'
   25 |     cin.tie(false); cout.tie(false);
      |                  ^
In file included from /usr/include/c++/10/ios:44,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from met.cpp:1:
/usr/include/c++/10/bits/basic_ios.h:295:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  295 |       tie() const
      |       ^~~
/usr/include/c++/10/bits/basic_ios.h:295:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/10/bits/basic_ios.h:307:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/10/bits/basic_ios.h:307:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
met.cpp:25:35: error: no matching function for call to 'std::basic_ostream<char>::tie(bool)'
   25 |     cin.tie(false); cout.tie(false);
      |                                   ^
In file included from /usr/include/c++/10/ios:44,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from met.cpp:1:
/usr/include/c++/10/bits/basic_ios.h:295:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  295 |       tie() const
      |       ^~~
/usr/include/c++/10/bits/basic_ios.h:295:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/10/bits/basic_ios.h:307:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/10/bits/basic_ios.h:307:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
met.cpp:46:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |                 for(int j = 0; j < v[ i ].size(); j ++){
      |                                ~~^~~~~~~~~~~~~~~
met.cpp:55:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |                 for(int j = 0; j < v[ i ].size(); j ++){
      |                                ~~^~~~~~~~~~~~~~~