Submission #1294117

#TimeUsernameProblemLanguageResultExecution timeMemory
1294117zahra_Match (CEOI16_match)C++20
0 / 100
0 ms332 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main(){ string s; cin >> s; string ans = ""; int cnt = 0; int n = s.size(); if(n % 2 != 0){ cout << -1 << endl; return 0; }else{ for(int i = 0 ; i < n ; i++){ if(cnt > 0){ ans += ')'; cnt--; }else{ ans += '('; cnt++; } } } if(cnt != 0 ){ cout << -1 << endl; }else{ cout << ans << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...