제출 #830366

#제출 시각아이디문제언어결과실행 시간메모리
830366AmylopectinHomework (CEOI22_homework)C++14
100 / 100
78 ms74876 KiB
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
const int mxn = 2e7 + 10;
char s[mxn] = {};
int cru,retl,retr,cou;
int re(int cn)
{
    int i,j,cl,cr,fl,fr,l1,l2,sta,ccou,tl,tr;
    if(s[cru+1] == 'a')
    {
        sta = 0;
    }
    else 
    {
        sta = 1;
    }
    if(s[cru + 4] == '?')
    {
        cl = 0;
        cr = 0;
        l1 = 1;
        cou ++;
        cru += 5;
    }
    else 
    {
        cru += 4;
        ccou = cou;
        re(0);
        l1 = cou - ccou;
        cl = retl;
        cr = retr;
    }
    if(s[cru+1] == '?')
    {
        fl = 0;
        fr = 0;
        l2 = 1;
        cou ++;
        cru += 2;
    }
    else 
    {
        cru ++;
        ccou = cou;
        re(0);
        l2 = cou - ccou;
        fl = retl;
        fr = retr;
    }
    if(sta == 0)
    {
        tr = max(cr + l2,fr + l1);
        tl = min(cl + l2,fl + l1);
        tl = min(tl,cl+1+fl);
    }
    else 
    {
        tr = max(cr,fr);
        tl = min(cl,fl);
        tr = max(tr,cr+fr);
    }
    cru ++;
    retl = tl;
    retr = tr;
    return 0;
}
int main()
{
    int i,j,n,m,cn,cm,fn,fm;
    scanf("%s",&s);
    n = strlen(s);
    cru = 0;
    cou = 0;
    re(0);
    printf("%d\n",retr - retl + 1);
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int re(int)':
Main.cpp:12:9: warning: unused variable 'i' [-Wunused-variable]
   12 |     int i,j,cl,cr,fl,fr,l1,l2,sta,ccou,tl,tr;
      |         ^
Main.cpp:12:11: warning: unused variable 'j' [-Wunused-variable]
   12 |     int i,j,cl,cr,fl,fr,l1,l2,sta,ccou,tl,tr;
      |           ^
Main.cpp: In function 'int main()':
Main.cpp:75:13: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[20000010]' [-Wformat=]
   75 |     scanf("%s",&s);
      |            ~^  ~~
      |             |  |
      |             |  char (*)[20000010]
      |             char*
Main.cpp:74:9: warning: unused variable 'i' [-Wunused-variable]
   74 |     int i,j,n,m,cn,cm,fn,fm;
      |         ^
Main.cpp:74:11: warning: unused variable 'j' [-Wunused-variable]
   74 |     int i,j,n,m,cn,cm,fn,fm;
      |           ^
Main.cpp:74:13: warning: variable 'n' set but not used [-Wunused-but-set-variable]
   74 |     int i,j,n,m,cn,cm,fn,fm;
      |             ^
Main.cpp:74:15: warning: unused variable 'm' [-Wunused-variable]
   74 |     int i,j,n,m,cn,cm,fn,fm;
      |               ^
Main.cpp:74:17: warning: unused variable 'cn' [-Wunused-variable]
   74 |     int i,j,n,m,cn,cm,fn,fm;
      |                 ^~
Main.cpp:74:20: warning: unused variable 'cm' [-Wunused-variable]
   74 |     int i,j,n,m,cn,cm,fn,fm;
      |                    ^~
Main.cpp:74:23: warning: unused variable 'fn' [-Wunused-variable]
   74 |     int i,j,n,m,cn,cm,fn,fm;
      |                       ^~
Main.cpp:74:26: warning: unused variable 'fm' [-Wunused-variable]
   74 |     int i,j,n,m,cn,cm,fn,fm;
      |                          ^~
Main.cpp:75:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |     scanf("%s",&s);
      |     ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...