Submission #930415


Source Code Expand

Copy
#include "bits/stdc++.h"
using namespace std;

//#define int int64_t

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

#define breakif(cond) if(cond) break; else

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

const int INF = 1 << 29;

signed main() {
	string s; cin >> s;
	int ans = 0;
	rep(i, s.size()) {
		if (i % 2 == 0) {
			ans += s[i] == 'g' ? 0 : -1;
		} else {
			ans += s[i] == 'g' ? 1 : 0;
		}
	}
	cout << ans << endl;
	system("pause");
}

Submission Info

Submission Time
Task D - AtCoDeer and Rock-Paper
User tosaka2
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1047 Byte
Status
Exec Time 8 ms
Memory 760 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:41:17: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
  system("pause");
                 ^

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 300 / 300 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt
Case Name Status Exec Time Memory
0_000.txt 4 ms 504 KB
0_001.txt 4 ms 504 KB
1_002.txt 7 ms 640 KB
1_003.txt 6 ms 632 KB
1_004.txt 7 ms 640 KB
1_005.txt 6 ms 632 KB
1_006.txt 7 ms 640 KB
1_007.txt 4 ms 504 KB
1_008.txt 7 ms 640 KB
1_009.txt 7 ms 640 KB
1_010.txt 7 ms 760 KB
1_011.txt 6 ms 632 KB
1_012.txt 7 ms 640 KB
1_013.txt 4 ms 504 KB
1_014.txt 7 ms 640 KB
1_015.txt 7 ms 640 KB
1_016.txt 7 ms 640 KB
1_017.txt 7 ms 640 KB
1_018.txt 7 ms 760 KB
1_019.txt 4 ms 500 KB
1_020.txt 8 ms 760 KB
1_021.txt 7 ms 640 KB
1_022.txt 7 ms 760 KB
1_023.txt 7 ms 640 KB
1_024.txt 7 ms 640 KB