全部评论 4

  • #include<bits/stdc++.h>
    using namespace std;
    const int Max=1010;
    int n,m=1,size,tot1,tot2,p1[Max],p2[Max],first[Max],f[Max],num[Max],vis[Max];
    struct shu{int to,next,len;}edge[MaxMax];
    inline int get_int() {
    int x=0,f=1;
    char c;
    for(c=getchar(); (!isdigit(c))&&(c!='-'); c=getchar());
    if(c=='-') f=-1,c=getchar();
    for(; isdigit(c); c=getchar()) x=(x<<3)+(x<<1)+c-'0';
    return x
    f;
    }
    inline void build(int x,int y) {
    edge[size].next=first[x],first[x]=size,edge[size].to=y;
    edge[size].next=first[y],first[y]=size,edge[size].to=x;
    }
    inline void pre() {
    f[n]=num[n];
    for(int i=n-1; i>=1; i--) f[i]=min(f[i+1],num[i]);
    for(int i=1; i<=n; i
    ) for(int j=i+1; j<=n; j
    ) if(f[j]<num[i]&&num[i]<num[j]) build(i,j);
    }
    inline bool dfs(int p,int color) {
    vis[p]=color;
    for(int u=first[p]; u; u=edge[u].next) {
    int to=edge[u].to;
    if(!vis[to]) dfs(to,3-color);
    else if(colorvis[to]) return 0;
    }
    return 1;
    }
    int main() {
    n=get_int();
    for(int i=1; i<=n; i++) num[i]=get_int();
    pre();
    for(int i=1; i<=n; i++) if(!vis[i]&&!dfs(i,1)){puts("0"); return 0;}
    for(int i=1; i<=n; i++) {
    if(vis[i]1)p1[++tot1]=num[i],printf("a ");
    else p2[++tot2]=num[i],printf("c ");
    while(m
    p1[tot1]||m
    p2[tot2]) {
    if(m==p1[tot1]) tot1--,printf("b ");
    else tot2--,printf("d ");
    m++;
    }
    }
    }

    2025-09-24 来自 浙江

    0
  • /code/judger/run/20250722/5054479695523872865/main.cpp: In function 'void push_and_pop()':
    /code/judger/run/20250722/5054479695523872865/main.cpp:35:29: error: expected ')' before 'i'
    35 | if((!st1.empty())&&st1.top()i){
    | ~ ^
    | )
    /code/judger/run/20250722/5054479695523872865/main.cpp:39:34: error: expected ')' before 'i'
    39 | else if((!st2.empty())&&st2.top()i){
    | ~ ^
    | )
    /code/judger/run/20250722/5054479695523872865/main.cpp:42:4: error: 'x1' was not declared in this scope; did you mean 'x'?
    42 | if(x1){
    | ^~
    | x
    compilation terminated due to -fmax-errors=3.

    2025-07-22 来自 重庆

    0
  • /code/judger/run/20250525/5043992401935368290/main.cpp: In function 'void push_and_pop()':
    /code/judger/run/20250525/5043992401935368290/main.cpp:35:29: error: expected ')' before 'i'
    35 | if((!st1.empty())&&st1.top()i){
    | ~ ^
    | )
    /code/judger/run/20250525/5043992401935368290/main.cpp:39:34: error: expected ')' before 'i'
    39 | else if((!st2.empty())&&st2.top()i){
    | ~ ^
    | )
    /code/judger/run/20250525/5043992401935368290/main.cpp:42:4: error: 'x1' was not declared in this scope; did you mean 'x'?
    42 | if(x1){
    | ^~
    | x
    compilation terminated due to -fmax-errors=3.

    2025-05-25 来自 北京

    0
  • 编译错误: /code/judger/test/1766263593769795584/main11.cpp: In function 'void push_and_pop()':
    /code/judger/test/1766263593769795584/main11.cpp:35:29: error: expected ')' before 'i'
    if((!st1.empty())&&st

    2024-03-09 来自 浙江

    0
    • /code/judger/run/20251011/5069229225796436065/main.cpp: In function 'void push_and_pop()':
      /code/judger/run/20251011/5069229225796436065/main.cpp:35:29: error: expected ')' before 'i'
      35 | if((!st1.empty())&&st1.top()i){
      | ~ ^
      | )
      /code/judger/run/20251011/5069229225796436065/main.cpp:39:34: error: expected ')' before 'i'
      39 | else if((!st2.empty())&&st2.top()i){
      | ~ ^
      | )
      /code/judger/run/20251011/5069229225796436065/main.cpp:42:4: error: 'x1' was not declared in this scope; did you mean 'x'?
      42 | if(x1){
      | ^~
      | x
      compilation terminated due to -fmax-errors=3.

      2025-10-11 来自 浙江

      0
暂无数据

提交答案之后,这里将显示提交结果~

首页