QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#259820 | #5262. Płytkie nawiasowania | mikefeng | 0 | 2ms | 4948kb | C++14 | 1.4kb | 2023-11-21 14:42:45 | 2023-11-21 14:42:45 |
answer
bool M1;
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<iomanip>
#include<cassert>
#include<random>
#include<cstdio>
#include<vector>
#include<bitset>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<ctime>
#include<map>
#include<set>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
//#include<ext/pb_ds/priority_queue.hpp>
#define fi first
#define se second
#define ll long long
#define Vector Point
#define I128 __int128
#define LD long double
#define ull unsigned ll
#define pii pair<ll,int>
#define pb(x) push_back(x)
#define syt cerr<<"sytakioi\n"
#define F(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
#define look_memory cerr<<abs(&M2-&M1)/1024.0/1024<<'\n'
#define rd_i(l,r) uniform_int_distribution<int>(l,r)(rd)
#define rd_r(l,r) uniform_real_distribution<double>(l,r)(rd)
#define look_time cerr<<(clock()-Time)*1.0/CLOCKS_PER_SEC<<'\n'
using namespace std;
//using namespace __gnu_cxx;
mt19937 rd(time(0));
const int N=1e6+5;
int n,h,t,mx;
char c[N];
bool M2;
signed main(){
int Time=clock();
look_memory;
cin.tie(nullptr)->sync_with_stdio(false);
cin>>n>>h>>(c+1);
F(i,1,n){
if(c[i]=='(') ++t;
else --t;
mx=max(mx,t);
}
cout<<2*max(0,mx-h)<<'\n';
look_time;
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 20
Accepted
time: 0ms
memory: 3928kb
input:
2 1 ()
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
20 10 ()()()()()()()()()()
output:
0
result:
ok single line: '0'
Test #3:
score: -20
Wrong Answer
time: 0ms
memory: 3996kb
input:
20 1 (((()())(()))(()()))
output:
6
result:
wrong answer 1st lines differ - expected: '10', found: '6'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #41:
score: 0
Wrong Answer
time: 2ms
memory: 4948kb
input:
1000000 18 ((((((((((((((((((()())(()()))((()())(()())))(((()())(()()))((()())(()()))))((((()())(()()))((()())(()())))(((()())(()()))((()())(()())))))(((((()())(()()))((()())(()())))(((()())(()()))((()())(()()))))((((()())(()()))((()())(()())))(((()())(()()))((()())(()()))))))((((((()())(()()))((()(...
output:
2
result:
wrong answer 1st lines differ - expected: '4', found: '2'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%