답안 #877242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
877242 2023-11-23T04:44:58 Z Frosty_Jonson Bootfall (IZhO17_bootfall) C++14
0 / 100
0 ms 344 KB
#include "bits/stdc++.h"

using namespace std;
using ull = unsigned long long int;
using ll = long long;
#define full(x) x.begin(),x.end()
const int mod = 1e9 + 7;


void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    int nums = 0;
    vector<int> ans;
    bool check = true;

    for (int i = 0; i < a.size(); ++i) {
        cout << "nums repu - " << nums << endl;
        check = true;
        for (int j = 0; j < a.size(); ++j) {
            check = (sum - nums) % 2;
            check = (sum - a.at(i) + nums) % 2;
            cout << "every check - " << (sum - a.at(i) + nums) % 2 << endl;
            cout << "checkie - " << check << endl;
        }

        if (check) {
            ans.push_back(nums);
            cnt++;
        }

        nums++;

    }
    if (ans.size() == 0) cout << 0;
    else {
        cout << cnt << endl;
        for (int i = 0; i < ans.size(); ++i) {
            cout << a.at(i) << " ";
        }
    }
}


int main() {
    clock_t startTime = clock();
    cin.tie(0)->sync_with_stdio(false);

#ifdef Behruzbek
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int queries = 1;
//    cin >> queries

    for (int test_case = 1; test_case <= queries; test_case++) {
        solve();
        cout << '\n';
    }


    // cout << "Time: " << ((double) (clock() - startTime) / CLOCKS_PER_SEC * 1000) << " ms" << endl;
}

Compilation message

bootfall.cpp: In function 'void solve()':
bootfall.cpp:24:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for (int i = 0; i < a.size(); ++i) {
      |                     ~~^~~~~~~~~~
bootfall.cpp:27:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for (int j = 0; j < a.size(); ++j) {
      |                         ~~^~~~~~~~~~
bootfall.cpp:45:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         for (int i = 0; i < ans.size(); ++i) {
      |                         ~~^~~~~~~~~~~~
bootfall.cpp: In function 'int main()':
bootfall.cpp:53:13: warning: unused variable 'startTime' [-Wunused-variable]
   53 |     clock_t startTime = clock();
      |             ^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -