Submission
Id | When | Author | Problem | Language | CPU | Memory | Verdict |
---|---|---|---|---|---|---|---|
16894 | 2024-04-21 19:52:25 | punter | Square Reconstruction | C++ 17 | 60 ms | 3412 kb | Wrong Answer - 3 |
Test Cases
CPU | Memory | Verdict | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 2 ms | 3284 kb | Accepted | ||||||||
2 | 1 ms | 3392 kb | Accepted | ||||||||
3 | 60 ms | 3412 kb | Wrong Answer | ||||||||
4 | - | - | Skipped | ||||||||
5 | - | - | Skipped | ||||||||
6 | - | - | Skipped | ||||||||
7 | - | - | Skipped | ||||||||
8 | - | - | Skipped | ||||||||
9 | - | - | Skipped | ||||||||
10 | - | - | Skipped | ||||||||
Source Code
program.cpp
/** * Author : Arif Ahmad * Date : * Algo : * Difficulty: */ #include <bits/stdc++.h> using namespace std; #define INF_MAX 2147483647 #define INF_MIN -2147483648 #define INF (1 << 30) #define EPS 1e-9 #define PI acos(-1.0) #define N 11234 #define MOD 10000000007 #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define pb push_back #define mp make_pair #define ms(x, a) memset((x), (a), sizeof(x)) #define F first #define S second #define rep(i,a,b) for(int i=(a); i<(b); ++i) #define repC(i,x) for(size_t i=0; i<x.size(); ++i) #define repIT(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define nn '\n' #define trace(x) cerr << #x << " = " << x << '\n'; #define trace2(x,y) cerr << #x << "=" << x << "\t" << #y << "=" << y << '\n'; typedef long long LL; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<string> vs; typedef vector<char> vc; typedef vector<bool> vb; typedef vector< pii > vii; typedef map<string,int> msi; typedef map<int,int> mii; typedef map<char,int> mci; typedef map<int,string> mis; template<class T> T Abs(T x) {return x>0 ? x : -x;} template<class T> T Max(T a, T b) {return a>b ? a : b;} template<class T> T Min(T a, T b) {return a<b ? a : b;} template<class T> T gcd(T a, T b) {return (b ? gcd(b,a%b) : a);} bool isVowel(char ch){ch=tolower(ch);return(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u');} //int dx[4] = {-1, 0, 0, 1}; //int dy[4] = {0, -1, 1, 0}; //int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; //int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; vi factors; void prime_factorize(int n) { factors.clear(); factors.resize(N, 0); for(int i = 2; i * i <= n; i++) { while(n % i == 0) { factors[i]++; n /= i; } } if(n > 1) { factors[n]++; } } int main() { ios_base :: sync_with_stdio(0); cin.tie(0); // #ifndef ONLINE_JUDGE // freopen("in.txt", "r", stdin); // #endif int i, j, k, n, m, tc; cin >> tc; while(tc--) { cin >> n; prime_factorize(n); int ans = 1; for(i = 2; i < N; i++) { if(factors[i] > 0 && factors[i] % 2 == 1) { ans *= i; } } if(ans == 1 and n > 1) ans = n; cout << ans << nn; } return 0; } /* */