Submission #2246679
Source Code Expand
#include <iostream> #include <string> #include <vector> #define INC(i, a, b) for(int i = a; i < b; ++i) #define DEC(i, a, b) for(int i = a; i > b; --i) #define REP(i, n) INC(i, 0, n) typedef unsigned int uint; typedef unsigned long ul; typedef long long ll; typedef unsigned long long ull; void TFprint(bool b, std::string T, std::string F){ if(b){ std::cout << T << std::endl; }else{ std::cout << F << std::endl; } } int judge(ull left, ull right){ if(left < right){ return 1; }else if(left > right){ return -1; }else{ return 0; } } int main(){ int n; std::cin >> n; ull left = 0, right = 0; int ans = 1, i = 0; int inc_dec; std::cin >> left; std::cin >> right; i = 2; inc_dec = judge(left, right); while(true){ //std::cout << "i: " << i << std::endl; left = right; std::cin >> right; i++; if(judge(left, right) * inc_dec == -1){ ans++; if(i == n){ break; } left = right; std::cin >> right; i++; } inc_dec = judge(left, right); if(i == n){ break; } } std::cout << ans << std::endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Sorted Arrays |
User | kumachan_atcoder |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1359 Byte |
Status | WA |
Exec Time | 2107 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
subtask_1_01.txt | AC | 25 ms | 256 KB |
subtask_1_02.txt | AC | 20 ms | 256 KB |
subtask_1_03.txt | AC | 13 ms | 256 KB |
subtask_1_04.txt | AC | 42 ms | 256 KB |
subtask_1_05.txt | AC | 40 ms | 256 KB |
subtask_1_06.txt | AC | 41 ms | 256 KB |
subtask_1_07.txt | WA | 40 ms | 256 KB |
subtask_1_08.txt | AC | 40 ms | 256 KB |
subtask_1_09.txt | WA | 41 ms | 256 KB |
subtask_1_10.txt | TLE | 2103 ms | 256 KB |
subtask_1_11.txt | TLE | 2107 ms | 256 KB |