QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#30015 | #237. Triangle Partition | srf | Compile Error | / | / | C++ | 871b | 2022-04-24 08:38:27 | 2022-05-18 04:25:12 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-05-18 04:25:12]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-04-24 08:38:27]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
int T;
int n,ansbase;
struct data{
int a,b;
bool operator < (const data w) const{
return a + max(0,w.a - b) < w.a + max(0,a - w.b);
}
}a[100050];
void work(data &t){
string s;
cin >> s;
t.a = t.b = 0;
int l = 0;
for (int i = 0; i < s.size(); ++i){
if (s[i] == '(') ++l;
else{
if (l > 0) ansbase += 2,--l;
else ++t.a;
}
}
t.b = l;
}
void solve(){
ansbase = 0;
int suma = 0,sumb = 0;
cin >> n;
for (int i = 1; i <= n; ++i) work(a[i]),suma += a[i].a,sumb += a[i].b;
sort(a + 1,a + n + 1);
int now = 0,premax = 0;
for (int i = 1; i <= n; ++i){
now += a[i].a,premax = max(premax,a[i].a);
now -= a[i].b;
}
ansbase += 2*(suma-premax);
cout<<ansbase<<'\n';
}
int main(){
ios::sync_with_stdio(0);
cin >> T;
while (T--) solve();
return 0;
}
詳細信息
answer.code:14:6: error: variable or field ‘work’ declared void 14 | void work(data &t){ | ^~~~ answer.code:14:11: error: reference to ‘data’ is ambiguous 14 | void work(data &t){ | ^~~~ In file included from /usr/include/c++/11/string:54, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/bits/range_access.h:319:5: note: candidates are: ‘template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)’ 319 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/11/bits/range_access.h:310:5: note: ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])’ 310 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/11/bits/range_access.h:300:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)’ 300 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/11/bits/range_access.h:290:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)’ 290 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ answer.code:7:8: note: ‘struct data’ 7 | struct data{ | ^~~~ answer.code:14:17: error: ‘t’ was not declared in this scope 14 | void work(data &t){ | ^ answer.code: In function ‘void solve()’: answer.code:33:38: error: ‘work’ was not declared in this scope 33 | for (int i = 1; i <= n; ++i) work(a[i]),suma += a[i].a,sumb += a[i].b; | ^~~~