QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#544878#8553. Exchanging KubicRykonyCompile Error//C++202.0kb2024-09-02 20:44:272024-09-02 20:44:29

Judging History

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

  • [2024-09-02 20:44:29]
  • 评测
  • [2024-09-02 20:44:27]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
#define INF 1e15

struct node{
    int l;
    int r;
    LL sum;
};

int main()
{
    int _=1;
    cin>>_;
    while (_--){
        int n;
        cin>>n;
        vector <node> a;
        vector <LL> ans(n+10,0);
        LL x;
        for (int i=1;i<=n;i++){
            cout<<"? "<<i<<" "<<i<<'\n';
            cin>>x;
            a.push_back({i,i,x});
            ans[i]=x;
        }
        
        auto nor=[&](vector <node> a)
        {
	        int l=0,tp=a[0].sum;
	        LL sum=0;
	        vector <node> z;
	        for (int i=0;i<(int)a.size();i++){
	            if (!a[i].sum){
	                if (tp){
	                    z.push_back({a[l].l,a[i-1].r,sum});
	                    tp=0;
	                    l=i;
	                }
	                sum=0;
	            }
	            else{
					if (!tp){
						z.push_back({a[l].l,a[i-1].r,sum});
						tp=a[i].sum;
						l=i;
					}
					sum+=a[i].sum;
				}
	        }
	        z.push_back({a[l].l,a[a.size()-1].r,sum});
	        return z;
		};
		
        vector <node> z;
        LL mss=0,res;
        while (1){
        	int cnt=0;
        	z=nor(a);
        	a.clear();
        	int zp=0;
	        for (int i=0;i<(int)z.size()-2;i++){
				if (i&&!z[i].sum&&!zp) a.push_back(z[i]);
				if (!z[i].sum) continue;
				if (z[i].sum&&z[i+2].sum&&!z[i+1].sum) cout<"NOOOOO";
				mss=max(z[i].sum,z[i+2].sum);
				cout<<"? "<<z[i].l<<" "<<z[i+2].r<<'\n';
				cin>>res;
				if (res>=mss){
					ans[z[i+1].l]=-z[i].sum-z[i+2].sum+res;
					z[i+2]={z[i].l,z[i+2].r,res};
					cnt++;
					zp=1;
				}
				else a.push_back(z[i]),zp=0;
			}
			int f=z.size()-1;
			if (z[f-1].sum) a.push_back(z[f-1]);
			else if (!zp) a.push_back(z[f-1]),a.push_back(z[f]);
			else a.push_back(z[f]);
			if (!cnt) break;
    	}
		cout<<"! ";
		
		for (int i=1;i<=n;i++){
			if (ans[i-1]>0&&!ans[i]) ans[i]=-INF;
			cout<<ans[i]<<" ";
		}
		cout<<'\n';
    }
}

Details

answer.code: In function ‘int main()’:
answer.code:67:76: error: no match for ‘operator<’ (operand types are ‘std::ostream’ {aka ‘std::basic_ostream<char>’} and ‘const char [7]’)
   67 |                                 if (z[i].sum&&z[i+2].sum&&!z[i+1].sum) cout<"NOOOOO";
      |                                                                        ~~~~^~~~~~~~~
      |                                                                        |    |
      |                                                                        |    const char [7]
      |                                                                        std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181,
                 from answer.code:1:
/usr/include/c++/13/bits/regex.h:1288:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Alloc> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’ (reversed)
 1288 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1288:5: note:   template argument deduction/substitution failed:
answer.code:67:77: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘const char [7]’
   67 |                                 if (z[i].sum&&z[i+2].sum&&!z[i+1].sum) cout<"NOOOOO";
      |                                                                             ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1456:5: note: candidate: ‘template<class _Bi_iter> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’ (reversed)
 1456 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1456:5: note:   template argument deduction/substitution failed:
answer.code:67:77: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘const char [7]’
   67 |                                 if (z[i].sum&&z[i+2].sum&&!z[i+1].sum) cout<"NOOOOO";
      |                                                                             ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1629:5: note: candidate: ‘template<class _Bi_iter> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’ (reversed)
 1629 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1629:5: note:   template argument deduction/substitution failed:
answer.code:67:77: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘const char [7]’
   67 |                                 if (z[i].sum&&z[i+2].sum&&!z[i+1].sum) cout<"NOOOOO";
      |                                                                             ^~~~~~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:67,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/stl_iterator.h:583:5: note: candidate: ‘template<class _IteratorL, class _IteratorR>  requires  three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&)’ (reversed)
  583 |     operator<=>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:583:5: note:   template argument deduction/substitution failed:
answer.code:67:77: note:   mismatched types ‘const std::reverse_iterator<_IteratorL>’ and ‘const char [7]’
   67 |                                 if (z[i].sum&&z[i+2].sum&&!z[i+1].sum) cout<"NOOOOO";
      |                                                                             ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note: candidate: ‘template<class _IteratorL, class _IteratorR>  requires  three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’ (reversed)
 1690 |     operator<=>(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note:   template argument deduction/substitution failed:
answer.code:67:77: note:   mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘const char [7]’
   67 |                                 if (z[i].sum&&z[i+2].sum&&!z[i+1].sum) cout<"NOOOOO";
      |                                                                             ^~~~~~~~
In file included from /usr/include/c++/13/bits/basic_string.h:47,
                 from /usr/include/c++/13/string:54,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/inclu...