QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#546538#7695. Double UpOlegpresnyakov#Compile Error//C++201.2kb2024-09-04 08:47:192024-09-04 08:47:19

Judging History

你现在查看的是最新测评结果

  • [2024-09-04 08:47:19]
  • 评测
  • [2024-09-04 08:47:19]
  • 提交

answer

#include <algorithm>
#include <vector>
#include <iostream>
#include <array>
#include <queue>
#include <bitset>
#include <math.h>
#include <iomanip>

using namespace std;

#define ar array
typedef long long ll;
typedef int uci;
#define F first
#define S second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define irep(i, a, b) for(int i = a; i > (b); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
#define ve vector
typedef ve<int> vi;
typedef ve<vi> vvi;
#define int __int128_t


signed main(){
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);


    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n){
        cin >> a[i];
    }

    deque<int> q;
    q.push_back(a[0]);
    for(int i = 1; i < n; ++i){
        while(q.size() >= 2 && a[i] > q.back() && q[q.size() - 2] > q.back()){
            q.pop_back();
        }

        if(a[i] == q.back()){
            int x = a[i];
            while(!q.empty() && x == q.back()){
                q.pop_back();
                x += x;
            }

            q.push_back(x);
        }

        else{
            q.push_back(a[i]);
        }
    }

    cout << q.back() << "\n";
}

Details

answer.code: In function ‘int main()’:
answer.code:35:9: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘__int128’)
   35 |     cin >> n;
      |     ~~~ ^~ ~
      |     |      |
      |     |      __int128
      |     std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/13/iostream:42,
                 from answer.code:3:
/usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  325 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/13/istream:325:7: note:   conversion of argument 1 would be ill-formed:
answer.code:35:12: error: invalid conversion from ‘__int128’ to ‘void*’ [-fpermissive]
   35 |     cin >> n;
      |            ^
      |            |
      |            __int128
answer.code:35:12: error: cannot bind rvalue ‘(void*)((long int)n)’ to ‘void*&’
/usr/include/c++/13/istream:224:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  224 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/13/istream:224:7: note:   conversion of argument 1 would be ill-formed:
answer.code:35:12: error: cannot bind non-const lvalue reference of type ‘long double&’ to a value of type ‘__int128’
   35 |     cin >> n;
      |            ^
/usr/include/c++/13/istream:220:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  220 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/13/istream:220:7: note:   conversion of argument 1 would be ill-formed:
answer.code:35:12: error: cannot bind non-const lvalue reference of type ‘double&’ to a value of type ‘__int128’
   35 |     cin >> n;
      |            ^
/usr/include/c++/13/istream:216:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  216 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/13/istream:216:7: note:   conversion of argument 1 would be ill-formed:
answer.code:35:12: error: cannot bind non-const lvalue reference of type ‘float&’ to a value of type ‘__int128’
   35 |     cin >> n;
      |            ^
/usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  201 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:201:7: note:   conversion of argument 1 would be ill-formed:
answer.code:35:12: error: cannot bind non-const lvalue reference of type ‘long long unsigned int&’ to a value of type ‘__int128’
   35 |     cin >> n;
      |            ^
/usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  197 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:197:7: note:   conversion of argument 1 would be ill-formed:
answer.code:35:12: error: cannot bind non-const lvalue reference of type ‘long long int&’ to a value of type ‘__int128’
   35 |     cin >> n;
      |            ^
/usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:192:7: note:   conversion of argument 1 would be ill-formed:
answer.code:35:12: error: cannot bind non-const lvalue reference of type ‘long unsigned int&’ to a value of type ‘__int128’
   35 |     cin >> n;
      |            ^
/usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  188 |       operator>>(long& __n)
    ...