QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#864485#1. I/O Testlittle_oneCompile Error//C++14949b2025-01-20 17:20:572025-01-20 17:21:06

Judging History

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

  • [2025-01-20 17:21:06]
  • 评测
  • [2025-01-20 17:20:57]
  • 提交

config.txt


input_test

#include <cstdio>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
int n,p[1000005],to[1000005],cnt;
char s[1000005],t[1000005];
priority_queue < int,vector <int>,greater <int> > q;
int main(){
    scanf("%d",&n);
    for(int i = 1;i <= n;i++){
        scanf("%d",&p[i]);
        to[p[i]] = i;
    }
    for(int i = 1;i <= n;i += 2){
        if(i > 1){
            q.push(to[i - 1]);
        }
        q.push(to[i]);
        int tmp = q.top();
        q.pop();
        s[p[tmp]] = t[tmp] = '(';
    }
    q.push(to[n]);
    while(q.size()){
        int tmp = q.top();
        q.pop();
        s[p[tmp]] = t[tmp] = ')';
    }
    for(int i = 1;i <= n;i++){
        if(t[i] == '('){
            cnt++;
        }
        else{
            cnt--;
        }
        if(cnt < 0){
            printf("NIE");
            return 0;
        }
    }
    printf("%s",s + 1);
    return 0;
}

output_test


Details

Invalid Configuration File: failed to read Nin and Nout