Submission #2861153
Source Code Expand
#include <iostream> #include <string> #include <vector> #include <cstdlib> #include <cstdio> #include <cmath> #include <algorithm> #include <map> #include <stack> #include <queue> #include <set> #include <cstring> using namespace std; // ascending order #define vsort(v) sort(v.begin(), v.end()) // descending order #define vsort_r(v) sort(v.begin(), v.end(), greater<int>()) // ascending order #define asort(array, N) sort(array, array + N) // descending order #define asort_r(array, N) sort(array, array + N, greater<int>()) #define vunique(v) v.erase(unique(v.begin(), v.end()), v.end()) #define mp make_pair #define ts(x) to_string(x) typedef long long ll; typedef pair<int, int> P; const ll INF = 1e18; ll N; vector<ll> A; vector<ll> even; vector<ll> odd; bool check() { int count = 0; for(int i = 0; i < A.size(); i++) { if(A[i] > 0) count++; } if(count == 1) return true; return false; } int main(){ cin.tie(0); ios::sync_with_stdio(false); cin >> N; for(int i = 0; i < N; i++) { int a; cin >> a; A.push_back(a); } int i = 1; int count = 0; while(!check()){ if(count == A.size() - 1 || i >= A.size()) { cout << "No" << endl; return 0; } if(A[0] % 2 != A[i] % 2) i++; else if(A[i] > 0){ A[0] += A[i]; A[i] = -1; i = 1; count++; } else i++; } cout << "Yes" << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - Addition |
User | tsutarou10 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1399 Byte |
Status | WA |
Exec Time | 2103 ms |
Memory | 1400 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt |
All | sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | TLE | 2103 ms | 1400 KB |
in10.txt | TLE | 2103 ms | 1400 KB |
in11.txt | WA | 1 ms | 256 KB |
in12.txt | WA | 1 ms | 256 KB |
in2.txt | TLE | 2103 ms | 1400 KB |
in3.txt | TLE | 2103 ms | 1400 KB |
in4.txt | TLE | 2103 ms | 1400 KB |
in5.txt | TLE | 2103 ms | 1400 KB |
in6.txt | TLE | 2103 ms | 1400 KB |
in7.txt | TLE | 2103 ms | 1400 KB |
in8.txt | TLE | 2103 ms | 1400 KB |
in9.txt | TLE | 2103 ms | 1400 KB |
sample1.txt | WA | 1 ms | 256 KB |
sample2.txt | WA | 1 ms | 256 KB |