/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 356.0 KiB
#2 Accepted 2ms 496.0 KiB
#3 Accepted 2ms 484.0 KiB
#4 Accepted 2ms 332.0 KiB
#5 Accepted 84ms 632.0 KiB
#6 Time Exceeded ≥1030ms ≥560.0 KiB
#7 Time Exceeded ≥1047ms ≥600.0 KiB

Code

#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
using namespace std;

void solve(int cs) {
  int n;
  cin >> n;
  if (n & 1) {
    for (int i = 3; i * i <= n; i++) {
      if (n % i == 0) {
        cout << n / i << "\n";
        return;
      }
    }
    cout << 1 << "\n";
  } else cout << n / 2 << "\n";
  
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  cin >> tc;
  for (int cs = 1; cs <= tc; cs++) {
    solve(cs);
  }
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1052 Yet Another Array Partition
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-14 11:24:57
Judged At
2024-11-11 03:26:11
Judged By
Score
40
Total Time
≥1047ms
Peak Memory
≥632.0 KiB