답안 #953760

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
953760 2024-03-26T15:36:16 Z ramalzaher Superpozicija (COCI22_superpozicija) C++14
0 / 110
55 ms 3412 KB
#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

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 ++  )
      |                             ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 3360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 3360 KB Output isn't correct
2 Halted 0 ms 0 KB -