Submission #1160340

#TimeUsernameProblemLanguageResultExecution timeMemory
1160340Doncho_BonbonchoVudu (COCI15_vudu)C++17
0 / 140
1096 ms4160 KiB
#include <bits/stdc++.h> #include <vector> using namespace std; #ifndef LOCAL #define cerr if(false) cerr #endif #define out( x ) #x << " = " << x << " " #define endl "\n" template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; } template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; } typedef long long ll; const ll mod = 1e9 +7; const int MAX_N = 1e6 + 42; int main(){ #ifndef LOCAL std::ios_base::sync_with_stdio( false ); std::cin.tie( NULL ); std::cout.tie( NULL ); #endif int n; std::cin >> n; std::vector< int > a( n ); for( auto& j : a ) std::cin >> j; int P; std::cin >> P; for( auto& j : a ) j -= P; ll nas = 0; for( int i=0 ; i < n ; i++ ){ for( int j=i ; j < n ; j++ ){ ll currS = 0; for( int k=i ; k <= j ; k++ ){ currS += a[k]; } cerr << out( i ) << out( j ) << out( currS ) << endl; nas += ( currS >= 0 ); } } std::cout << nas << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...