Submission #3771958


Source Code Expand

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18


int main() {

	int n; cin >> n;

	vector<int> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	int r = 0;
	int ans = 0;


	for (int l = 0; l < n; l++) {
		while (r < n-1 && a[r] < a[r+1]) {
			r++;
		}

		ans += r - l + 1;

		if (l == r)r++;
	}

	cout << ans << endl;

	return 0;
}

Submission Info

Submission Time
Task C - 単調増加
User poporo
Language C++14 (GCC 5.4.1)
Score 40
Code Size 2312 Byte
Status WA
Exec Time 30 ms
Memory 640 KB

Judge Result

Set Name Sample Subtask0 All
Score / Max Score 0 / 0 40 / 40 0 / 60
Status
AC × 4
AC × 19
AC × 33
WA × 2
Set Name Test Cases
Sample sample0.txt, sample1.txt, sample2.txt, sample3.txt
Subtask0 sample0.txt, sample1.txt, sample2.txt, sample3.txt, subtask0_0.txt, subtask0_1.txt, subtask0_10.txt, subtask0_11.txt, subtask0_12.txt, subtask0_13.txt, subtask0_14.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt, subtask0_5.txt, subtask0_6.txt, subtask0_7.txt, subtask0_8.txt, subtask0_9.txt
All sample0.txt, sample1.txt, sample2.txt, sample3.txt, subtask0_0.txt, subtask0_1.txt, subtask0_10.txt, subtask0_11.txt, subtask0_12.txt, subtask0_13.txt, subtask0_14.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt, subtask0_5.txt, subtask0_6.txt, subtask0_7.txt, subtask0_8.txt, subtask0_9.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_2.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt
Case Name Status Exec Time Memory
sample0.txt AC 1 ms 256 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB
subtask0_0.txt AC 2 ms 256 KB
subtask0_1.txt AC 2 ms 256 KB
subtask0_10.txt AC 2 ms 256 KB
subtask0_11.txt AC 2 ms 256 KB
subtask0_12.txt AC 2 ms 256 KB
subtask0_13.txt AC 2 ms 256 KB
subtask0_14.txt AC 2 ms 256 KB
subtask0_2.txt AC 2 ms 256 KB
subtask0_3.txt AC 2 ms 256 KB
subtask0_4.txt AC 2 ms 256 KB
subtask0_5.txt AC 1 ms 256 KB
subtask0_6.txt AC 1 ms 256 KB
subtask0_7.txt AC 2 ms 256 KB
subtask0_8.txt AC 1 ms 256 KB
subtask0_9.txt AC 2 ms 256 KB
subtask1_0.txt AC 25 ms 512 KB
subtask1_1.txt AC 11 ms 384 KB
subtask1_10.txt AC 30 ms 640 KB
subtask1_11.txt WA 29 ms 640 KB
subtask1_12.txt AC 29 ms 640 KB
subtask1_13.txt AC 29 ms 640 KB
subtask1_14.txt AC 29 ms 640 KB
subtask1_15.txt WA 29 ms 640 KB
subtask1_2.txt AC 9 ms 384 KB
subtask1_3.txt AC 20 ms 512 KB
subtask1_4.txt AC 22 ms 512 KB
subtask1_5.txt AC 21 ms 512 KB
subtask1_6.txt AC 13 ms 384 KB
subtask1_7.txt AC 26 ms 640 KB
subtask1_8.txt AC 8 ms 384 KB
subtask1_9.txt AC 4 ms 256 KB