Submission #1117749

#TimeUsernameProblemLanguageResultExecution timeMemory
1117749vjudge1Match (CEOI16_match)C++17
10 / 100
2068 ms3320 KiB
// Telebe of adicto yani AzeTurk810 /* Author: AzeTurk810 Licance: open source(only authors name must be in code) Begin Time:11/23/2024 15:07 Problem link: https://basecamp.eolymp.com/az/problems/1533 */ #include <bits/stdc++.h> using namespace std; using ll= long long; using ull=unsigned long long; # define vint vector<int> # define endl '\n' # define range(a,b,c) for(int i=a;i<b;i+=c) # define arange(a,b,c) for(int i=a;i>b;i-=c) # define bend(x) (x).begin(),(x).end() # define pb push_back # define eb emplace_back # define fori(x) for(int i=0;i<x;i++) # define forj(y) for(int j=0;j<y;j++) # define forn(x,c) for(int i=0;i<n;i+=c) # define forv(v) for(auto kullan : (v)) # define ff first # define ss second # define INF 1e9 + 7 # define printfprs(v) for(int alma = 0;alma<(v).size();alma++){cout<<(v)[alma].ff<< ' '<<(v)[alma].ss<<endl;}; # define int int64_t # define hurryup ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) // mod(deysidirilmeli) ________________________________________________________________________________________________________ # define mod 998244353 void ansyn(bool t) { std::cout<<t?"Yes":"No"; } /*int work(int prv , int cur , int m) { m /= cur; int d = sqrt(prv) + 1; vint primes; vint powr; for(int i = 2; i<=d;i++) { if(prv % i ==0) { powr .eb(0); primes.pb(i); while(prv % i == 0) { prv /= i; ++powr.back(); } } } if(prv > 1) { primes.pb(prv); powr.eb(1); } vint powr_of_current(powr.size(), 0); fori(powr.size()) { while(cur % primes[i] == 0 ) { cur /= primes[i]; ++powr_of_current[i]; } } vint n_divisbele; int ans = m; fori(powr.size()) { if(powr_of_current[i] < powr[i]) { n_divisbele.eb(primes[i]); } } for(int ci= 1;ci < ( 1<<n_divisbele.size());ci++) { int juqli = 1; int pls_or_mns = 0; fori(n_divisbele.size()) { if(((ci>> i) & 1)) { pls_or_mns ^= 1; juqli *= n_divisbele[i]; } } if(pls_or_mns )526842 { ans -= m / juqli; } else { ans += m / juqli ; } } return ans % mod ; }*/ int n; string ansc; string solve(string s,int index , string ans,int res,stack<char>last) { int i = index; if(index >= n) { return (last.empty()?ans:"-1"); } if(!last.empty()) { last.push(s[i]); ansc = solve(s,index + 1,ans + '(',res,last); if(ansc == "-1" ) { last.pop(); //cout<<last.top()<<'|'; if(last.top()!= s[i]) return "-1"; last.pop(); return solve(s,index + 1 , ans + ')', res,last); } return ansc; } else { last.push(s[index]); //cout<<last.top()<<'/'; return solve(s,index + 1,ans + '(',res,last); } } signed main() { int t = 1; string s,ans = ""; stack<char>last; /* last.push('3'); last.push('5'); cout<<last.top(); 5----- */ while(t--) { cin>>s; n =s.size(); if(n % 2 != 0) { cout<<-1<<endl; } else { cout<<solve(s,0,ans,0,last); } } }

Compilation message (stderr)

match.cpp: In function 'void ansyn(bool)':
match.cpp:39:15: warning: second operand of conditional expression has no effect [-Wunused-value]
   39 |  std::cout<<t?"Yes":"No";
      |               ^~~~~
match.cpp:39:21: warning: third operand of conditional expression has no effect [-Wunused-value]
   39 |  std::cout<<t?"Yes":"No";
      |                     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...