Submission #953760

#TimeUsernameProblemLanguageResultExecution timeMemory
953760ramalzaherSuperpozicija (COCI22_superpozicija)C++14
0 / 110
55 ms3412 KiB
#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 ; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:3:36: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define FOR(i, n ) for(int i= 0; i < n ; i++ )
      |                                    ^
Main.cpp:25:13: note: in expansion of macro 'FOR'
   25 |             FOR(i , s.sz )
      |             ^~~
Main.cpp:31:29: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(int i =1; i < ans.sz ; i ++  )
      |                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...