Submission #916504

# Submission time Handle Problem Language Result Execution time Memory
916504 2024-01-26T02:57:38 Z knatwila Homework (CEOI22_homework) C++17
0 / 100
111 ms 15196 KB
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair	
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
#define F first
#define S second
#define left(v) (v) + (v)
#define right(v) (v) + (v) + 1
#define ll long long
#define int long long
using namespace std;
///using ll = long long;
//using ull = unsigned long long;
const int MAXN = 1e6 + 5;
const int inf = 4e9;
const long long INF = 1e16;
const int M = 998244353;
const int K = 300;
const int K2 = 600;
const int P = 191;
const int P2 = 191;
const double EPS = 1e-12;
void D_BASE(string name = "") {
	   if (sz(name)) {
	       freopen((name + ".in").c_str(), "r", stdin);
		   freopen((name + ".out").c_str(), "w", stdout);
	   }
	   ios_base::sync_with_stdio(0);
 	   cin.tie(0); 
	   cout.tie(0);
}
//13 20
string s;
void solve() {
	cin >> s;
	int ct = 1, cnt = 0;
	for (int i = 0; i < sz(s); ++i) {
		if(s[i] == '?') cnt++;
	}
	if(s.substr(0, 3) == "min") {
		for (int i = 0; i + 2 < sz(s); ++i) {
			if(s.substr(i, 3) == "max") ct++;
		}
	}
	else {
		for (int i = 0; i + 2 < sz(s); ++i) {
			if(s.substr(i, 3) == "min") ct++;
		}
	}
	cout << min(cnt, ct);
}
signed main() {
    D_BASE("");    
	int tt = 1, ct = 0;
	//cin >> tt;
    while (tt--) {
        //cout << "Case " << ++ct << ":\n";
		solve();
	}
	return 0;
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:38:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for (int i = 0; i < sz(s); ++i) {
      |                    ^
Main.cpp:42:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |   for (int i = 0; i + 2 < sz(s); ++i) {
      |                         ^
Main.cpp:47:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   for (int i = 0; i + 2 < sz(s); ++i) {
      |                         ^
Main.cpp: In function 'int main()':
Main.cpp:55:14: warning: unused variable 'ct' [-Wunused-variable]
   55 |  int tt = 1, ct = 0;
      |              ^~
Main.cpp: In function 'void D_BASE(std::string)':
Main.cpp:26:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         freopen((name + ".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:27:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |      freopen((name + ".out").c_str(), "w", stdout);
      |      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 111 ms 15196 KB Output is correct
2 Correct 105 ms 15060 KB Output is correct
3 Incorrect 109 ms 14548 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -