제출 #831475

#제출 시각아이디문제언어결과실행 시간메모리
831475OrazBMiners (IOI07_miners)C++14
45 / 100
1585 ms24668 KiB
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define ll long long int #define pii pair <int, int> #define pb push_back #define ff first #define ss second const int N = 1e5+5; int n; string s; int nw[26], c[N], A[3], mx = 0, vis[N]; pair<int,pii> dp[N][5]; int T(char c){ if (c == 'M') return 0; if (c == 'B') return 1; return 2; } int F(string str){ int ans = 0; for (int i = 0; i < str.size(); i++){ for (int j = i; j > max(i-3, -1); j--){ A[T(str[j])] = 1; } ans += A[0]+A[1]+A[2]; A[0] = A[1] = A[2] = 0; } return ans; } void bit(int x){ if (x == n){ string a = "", b = ""; for (int i = 0; i < n; i++){ if (c[i]) a += s[i]; else b += s[i]; } mx = max(mx, F(a)+F(b)); return; } for (int i = 0; i < 2; i++){ c[x] = i; bit(x+1); } } int main () { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> s; bit(0); cout << mx; }

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

miners.cpp: In function 'int F(std::string)':
miners.cpp:25:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |  for (int i = 0; i < str.size(); i++){
      |                  ~~^~~~~~~~~~~~
#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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...