Time Exceeded
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