QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#190511#3673. Generalized German QuotationmaghrabyJr_#WA 0ms3440kbC++20857b2023-09-29 00:50:462023-09-29 00:50:47

Judging History

你现在查看的是最新测评结果

  • [2023-09-29 00:50:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3440kb
  • [2023-09-29 00:50:46]
  • 提交

answer

#include "bits/stdc++.h"
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;

int32_t main(){
         cin.tie(0);
         cin.sync_with_stdio(0);

         string s; cin>>s;
         int n= s.length();
         stack<int> stk;
         char ans[n];
         for(int i = 0; i < n; i++){
                  if(!stk.empty() && s[stk.top()] != s[i]){
                           ans[stk.top()]= '[';
                           ans[i]= ']';
                           stk.pop();
                  }else{
                           stk.push(i);
                  }
         }

         if(stk.size()){
                  cout<<"Keine Loesung\n";
         }else{
                  for(char c : ans)
                           cout<<c;
                  cout<<"\n";
         }
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3440kb

input:

<<>><<<<>>>>

output:

[[]][[[[]]]]

result:

wrong answer Wrong solution length: 12 instead of 6