# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
953760 | ramalzaher | Superpozicija (COCI22_superpozicija) | C++14 | 55 ms | 3412 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int int64_t
#define FOR(i, n ) for(int i= 0; i < n ; i++ )
#define all(x) a.begin() , a.end()
#define sz size()
using namespace std;
const int N = 2e5 ;
int n ;string s;int a[N] , b[N] ;
signed main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int T; cin >> T ;
while(T--){
cin >> n ;
cin >> s ;
map<int,int> mp ;
FOR(i , n )
{
cin >> a[i] >> b[i];
mp[a[i]] =1 ;
}
string ans = "" ;
FOR(i , s.sz )
if(mp[i]==0){
char temp = s[i];
ans+=temp;}
cout<<ans<<endl;
stack<char> st ;st.push(s[0]) ;
for(int i =1; i < ans.sz ; i ++ )
{
if(st.sz != 0 && (st.top() == '(' && ans[i]==')'))
st.pop() ;else
st.push(ans[i]) ;
}
if(st.sz == 0 ){
FOR(i ,n )
cout<<1<<' ' ;
}else cout<<-1<<endl ;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |