Submission #1655880
Source Code Expand
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <numeric> #include <stack> #include <queue> #include <map> #include <set> #include <utility> #include <sstream> #include <complex> #include <fstream> #include <bitset> #include <time.h> #include <tuple> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef vector<ll> V; typedef complex<double> Point; #define PI acos(-1.0) #define EPS 1e-10 const ll INF = 1e12; const ll MOD = 1e9 + 7; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define rep(i,N) for(int i=0;i<(N);i++) #define ALL(s) (s).begin(),(s).end() #define EQ(a,b) (abs((a)-(b))<EPS) #define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) ) #define fi first #define se second #define N_SIZE (1LL << 20) #define NIL -1 #define MAX_N 100100 * 3 int n; int a[100100]; int b[100100]; int main() { cin >> n; rep(i, n) { cin >> a[i]; } a[n] = a[0]; int ans = 1; rep(i, n - 1) { ans += (a[i] > a[i + 1]); } int num = 1; rep(i, n - 1) { num += (a[i + 1] > a[i + 2]); } ans = min(ans, num); cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - ディスコ社内ツアー |
User | jimmy |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1235 Byte |
Status | WA |
Exec Time | 36 ms |
Memory | 768 KB |
Judge Result
Set Name | Sample | Small | Permutation | All | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 20 | 0 / 10 | 0 / 70 | ||||||||||||||
Status |
|
|
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt |
Small | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 10_rand_06.txt, 10_rand_07.txt, 10_rand_08.txt, 20_perm_01.txt, 20_perm_02.txt, 20_perm_03.txt, 20_perm_04.txt, 20_perm_05.txt, 20_perm_06.txt, 20_perm_07.txt, 20_perm_08.txt, 30_hand_01.txt, 30_hand_02.txt, 30_hand_03.txt, 30_hand_04.txt, 30_hand_05.txt, 30_hand_06.txt |
Permutation | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 20_perm_01.txt, 20_perm_02.txt, 20_perm_03.txt, 20_perm_04.txt, 20_perm_05.txt, 20_perm_06.txt, 20_perm_07.txt, 20_perm_08.txt, 30_hand_01.txt, 30_hand_02.txt, 60_perm_01.txt, 60_perm_02.txt, 60_perm_03.txt, 60_perm_04.txt, 60_perm_05.txt, 60_perm_06.txt, 60_perm_07.txt, 60_perm_08.txt, 70_hand_01.txt, 70_hand_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 10_rand_06.txt, 10_rand_07.txt, 10_rand_08.txt, 20_perm_01.txt, 20_perm_02.txt, 20_perm_03.txt, 20_perm_04.txt, 20_perm_05.txt, 20_perm_06.txt, 20_perm_07.txt, 20_perm_08.txt, 30_hand_01.txt, 30_hand_02.txt, 30_hand_03.txt, 30_hand_04.txt, 30_hand_05.txt, 30_hand_06.txt, 50_rand_01.txt, 50_rand_02.txt, 50_rand_03.txt, 50_rand_04.txt, 50_rand_05.txt, 50_rand_06.txt, 50_rand_07.txt, 50_rand_08.txt, 60_perm_01.txt, 60_perm_02.txt, 60_perm_03.txt, 60_perm_04.txt, 60_perm_05.txt, 60_perm_06.txt, 60_perm_07.txt, 60_perm_08.txt, 70_hand_01.txt, 70_hand_02.txt, 70_hand_03.txt, 70_hand_04.txt, 70_hand_05.txt, 70_hand_06.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 5 ms | 768 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
00_example_03.txt | AC | 1 ms | 256 KB |
00_example_04.txt | AC | 1 ms | 256 KB |
10_rand_01.txt | WA | 1 ms | 256 KB |
10_rand_02.txt | WA | 1 ms | 256 KB |
10_rand_03.txt | WA | 1 ms | 256 KB |
10_rand_04.txt | WA | 1 ms | 256 KB |
10_rand_05.txt | AC | 1 ms | 256 KB |
10_rand_06.txt | WA | 1 ms | 256 KB |
10_rand_07.txt | WA | 1 ms | 256 KB |
10_rand_08.txt | WA | 1 ms | 256 KB |
20_perm_01.txt | WA | 1 ms | 256 KB |
20_perm_02.txt | AC | 1 ms | 256 KB |
20_perm_03.txt | WA | 1 ms | 256 KB |
20_perm_04.txt | WA | 1 ms | 256 KB |
20_perm_05.txt | AC | 1 ms | 256 KB |
20_perm_06.txt | WA | 1 ms | 256 KB |
20_perm_07.txt | AC | 1 ms | 256 KB |
20_perm_08.txt | WA | 1 ms | 256 KB |
30_hand_01.txt | AC | 1 ms | 256 KB |
30_hand_02.txt | AC | 1 ms | 256 KB |
30_hand_03.txt | AC | 1 ms | 256 KB |
30_hand_04.txt | AC | 1 ms | 256 KB |
30_hand_05.txt | WA | 1 ms | 256 KB |
30_hand_06.txt | WA | 1 ms | 256 KB |
50_rand_01.txt | WA | 11 ms | 384 KB |
50_rand_02.txt | WA | 19 ms | 512 KB |
50_rand_03.txt | WA | 20 ms | 512 KB |
50_rand_04.txt | WA | 16 ms | 512 KB |
50_rand_05.txt | WA | 7 ms | 384 KB |
50_rand_06.txt | WA | 1 ms | 256 KB |
50_rand_07.txt | WA | 4 ms | 256 KB |
50_rand_08.txt | WA | 16 ms | 512 KB |
60_perm_01.txt | WA | 13 ms | 384 KB |
60_perm_02.txt | WA | 25 ms | 512 KB |
60_perm_03.txt | WA | 25 ms | 512 KB |
60_perm_04.txt | WA | 20 ms | 512 KB |
60_perm_05.txt | WA | 8 ms | 384 KB |
60_perm_06.txt | WA | 1 ms | 256 KB |
60_perm_07.txt | WA | 4 ms | 256 KB |
60_perm_08.txt | WA | 20 ms | 512 KB |
70_hand_01.txt | AC | 36 ms | 640 KB |
70_hand_02.txt | AC | 35 ms | 640 KB |
70_hand_03.txt | AC | 27 ms | 640 KB |
70_hand_04.txt | AC | 27 ms | 640 KB |
70_hand_05.txt | WA | 35 ms | 640 KB |
70_hand_06.txt | WA | 27 ms | 640 KB |