Submission #3401347
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;
#define TRACE(x) cerr << #x << " " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<
#define fi first
#define sec second
#define mp make_pair
const int MAXN = 110;
const int MAXM = 10010;
int n, p[MAXN];
int main() {
scanf("%d",&n);
REP(i, n) {
scanf("%d",&p[i]);
}
int sol = 0;
for (int i = MAXM; i; i--) {
int tmp = 0;
FOR(j, 1, n) {
if (p[j] != i) {tmp = 0; continue;}
if (p[j] == p[j - 1] && !tmp) {sol++; tmp = 1;}
else tmp = 0;
}
}
cout << sol << endl;
return 0;
}
Submission Info
Submission Time
2018-10-14 00:59:41+0900
Task
A - Colorful Slimes 2
User
mkisic
Language
C++14 (GCC 5.4.1)
Score
200
Code Size
845 Byte
Status
AC
Exec Time
2 ms
Memory
256 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:26:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:28:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&p[i]);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
200 / 200
Status
Set Name
Test Cases
Sample
example_0, example_1, example_2, example_3
All
example_0, example_1, example_2, example_3, handmade_0, handmade_1, rand_0, rand_1, smallcolor_0, smallcolor_1, smallcolor_2, smallcolor_3, smallcolor_4
Case Name
Status
Exec Time
Memory
example_0
AC
1 ms
256 KB
example_1
AC
1 ms
256 KB
example_2
AC
1 ms
256 KB
example_3
AC
1 ms
256 KB
handmade_0
AC
1 ms
256 KB
handmade_1
AC
1 ms
256 KB
rand_0
AC
1 ms
256 KB
rand_1
AC
1 ms
256 KB
smallcolor_0
AC
2 ms
256 KB
smallcolor_1
AC
2 ms
256 KB
smallcolor_2
AC
2 ms
256 KB
smallcolor_3
AC
2 ms
256 KB
smallcolor_4
AC
2 ms
256 KB