Submission #8622941


Source Code Expand

Copy
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n,k;
	std::cin >> n >> k;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];
	std::vector<int> ac(n+1,0);
	rep(i,n) ac[i+1] = (ac[i] + a[i])%k;
	int count = 0;
	rep(i,n) {
		for(int j=i;j<n;j++) {
			if(j-i+1 == ((ac[j+1]-ac[i]+k)%k)) count++;
		}
	}
	print(count);
	return 0;
}

Submission Info

Submission Time
Task E - Rem of Sum is Num
User zln
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1067 Byte
Status TLE
Exec Time 2103 ms
Memory 3328 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 14
TLE × 15
Set Name Test Cases
sample sample01, sample02, sample03
All few01, few02, few03, hand01, hand02, hand03, hand04, large01, large02, large03, max01, max02, max03, mid01, mid02, mid03, mid04, mid05, min01, min02, min03, sample01, sample02, sample03, small01, small02, small03, small04, small05
Case Name Status Exec Time Memory
few01 TLE 2103 ms 3328 KB
few02 TLE 2103 ms 3328 KB
few03 TLE 2103 ms 3328 KB
hand01 AC 1 ms 256 KB
hand02 TLE 2103 ms 3328 KB
hand03 TLE 2103 ms 3328 KB
hand04 TLE 2103 ms 3328 KB
large01 TLE 2103 ms 3072 KB
large02 TLE 2103 ms 3328 KB
large03 TLE 2103 ms 3200 KB
max01 TLE 2103 ms 3328 KB
max02 TLE 2103 ms 3328 KB
max03 TLE 2103 ms 3328 KB
mid01 AC 27 ms 256 KB
mid02 AC 30 ms 256 KB
mid03 AC 40 ms 256 KB
mid04 AC 24 ms 256 KB
mid05 AC 36 ms 256 KB
min01 TLE 2103 ms 2432 KB
min02 TLE 2103 ms 2432 KB
min03 TLE 2103 ms 2560 KB
sample01 AC 1 ms 256 KB
sample02 AC 1 ms 256 KB
sample03 AC 1 ms 256 KB
small01 AC 1 ms 256 KB
small02 AC 1 ms 256 KB
small03 AC 1 ms 256 KB
small04 AC 1 ms 256 KB
small05 AC 1 ms 256 KB