제출 #830361

#제출 시각아이디문제언어결과실행 시간메모리
830361petezaHomework (CEOI22_homework)C++14
10 / 100
1079 ms43804 KiB
#include <bits/stdc++.h> using namespace std; string str; int bin[1000005][2]; int type[1000005]; int cnode = 0; stack<int> stk; set<int> S; vector<int> vec; int ci = 0; int dfs(int x) { if(type[x] == 2) return vec[ci++]; int e1 = dfs(bin[x][0]), e2 = dfs(bin[x][1]); return (type[x] ? max(e1, e2) : min(e1, e2)); } int main() { cin >> str; for(int i=0;i<str.size();) { if(str[i] == ',' || str[i]=='('){i++; continue;} if(str[i] == 'm') { stk.push(cnode); if(str[i+1] == 'i') { //minimum type[cnode++] = 0; } else { type[cnode++] = 1; } i += 4; } else if(str[i] == '?') { stk.push(cnode); type[cnode++] = 2; i++; } else { int e1 = stk.top(); stk.pop(); int e2 = stk.top(); stk.pop(); bin[stk.top()][0] = e2; bin[stk.top()][1] = e1; i++; } } for(int i=1;i<=count(str.begin(), str.end(), '?');i++) vec.push_back(i); //for(int i=0;i<cnode;i++) cout << bin[i][0] << ' ' << bin[i][1] << '\n'; do { ci = 0; S.insert(dfs(0)); } while (next_permutation(vec.begin(), vec.end())); cout << S.size(); }

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

Main.cpp: In function 'int main()':
Main.cpp:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i=0;i<str.size();) {
      |                 ~^~~~~~~~~~~
#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...