Submission #14102528


Source Code Expand

#include <iostream>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <climits>
#include <stdlib.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
typedef long double ld;
using namespace std;




vector<ll> sieve(ll n)
{
	vector<ll> a(n+1,0);
	for(ll i=3;i<=n;i+=2)
	a[i]=1;
	for(ll i=3;i<=n;i+=2)
	{
       if(a[i]==1)
	   {
		   for(ll j=i*2;j<=n;j+=i)
		   a[j]=0;
	   }
	}
	a[2]=1;
	a[1]=a[0]=0;
	return a;
}
ll reverse(ll n)
{
	ll s=0;
	while(n>0)
	{
       ll t=n%10;
	   s=s*10+t;
	   n/=10;
	}
	return s;
}
int count_setbits(int N)

{ int cnt=0;

while(N>0)

{

cnt+=(N&1);

N=N>>1;

}

return cnt;

}
ll power(ll x, ll y)  
{  
    int res = 1;     // Initialize result  
  
    x = x % mod; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % mod;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % mod;  
    }  
    return res;  
}  

void BellmanFord(vector< vector<ll> > &graph, int V, int E, int src) 
{ 
    // Initialize distance of all vertices as infinite. 
    int dis[V]; 
    for (int i = 0; i < V; i++) 
        dis[i] = INT_MAX; 
  
    // initialize distance of source as 0 
    dis[src] = 0; 
  
    // Relax all edges |V| - 1 times. A simple 
    // shortest path from src to any other 
    // vertex can have at-most |V| - 1 edges 
    for (int i = 0; i < V - 1; i++) { 
  
        for (int j = 0; j < E; j++) { 
            if (dis[graph[j][0]] + graph[j][2] < 
                               dis[graph[j][1]]) 
                dis[graph[j][1]] =  
                  dis[graph[j][0]] + graph[j][2]; 
        } 
    } 
  
    // check for negative-weight cycles. 
    // The above step guarantees shortest 
    // distances if graph doesn't contain 
    // negative weight cycle.  If we get a 
    // shorter path, then there is a cycle. 
    for (int i = 0; i < E; i++) { 
        int x = graph[i][0]; 
        int y = graph[i][1]; 
        int weight = graph[i][2]; 
        if (dis[x] != INT_MAX && 
                   dis[x] + weight < dis[y]) 
            cout << "Graph contains negative"
                    " weight cycle"
                 << endl; 
    } 
  
    
} 
int main()
{
    ull n;
    cin>>n;
   unordered_map<ull,ull> mp;
   while(n%2==0)
   {
       mp[2]++;n/=2;
   }
    for (ull i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            mp[i]++;
            n = n/i;  
        }  
    }  
    if(n>2)
    mp[n]++;
    /*for(auto i:mp)
    cout<<i.first<<" "<<i.second<<"\n";*/
    ull res=0;
    ull i=1;
    for(auto j:mp)
    {
    while((i*(i+1)/2)<=j.second)
    {
        i++;
    }
    i--;res+=i;
    }
    cout<<res<<"\n";
    return 0;

}

Submission Info

Submission Time
Task D - Div Game
User avr99
Language C++ (GCC 9.2.1)
Score 0
Code Size 3255 Byte
Status WA
Exec Time 12 ms
Memory 3680 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 5
AC × 31
WA × 1
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, hand_17.txt, hand_18.txt, hand_19.txt, hand_20.txt, hand_21.txt, hand_22.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
Case Name Status Exec Time Memory
hand_01.txt AC 2 ms 3544 KiB
hand_02.txt AC 2 ms 3568 KiB
hand_03.txt AC 2 ms 3412 KiB
hand_04.txt AC 2 ms 3464 KiB
hand_05.txt AC 2 ms 3564 KiB
hand_06.txt AC 2 ms 3412 KiB
hand_07.txt AC 2 ms 3360 KiB
hand_08.txt AC 2 ms 3504 KiB
hand_09.txt AC 9 ms 3352 KiB
hand_10.txt AC 9 ms 3556 KiB
hand_11.txt AC 11 ms 3680 KiB
hand_12.txt AC 7 ms 3464 KiB
hand_13.txt AC 12 ms 3356 KiB
hand_14.txt AC 10 ms 3572 KiB
hand_15.txt AC 2 ms 3356 KiB
hand_16.txt AC 2 ms 3564 KiB
hand_17.txt AC 2 ms 3364 KiB
hand_18.txt AC 2 ms 3568 KiB
hand_19.txt AC 3 ms 3412 KiB
hand_20.txt AC 3 ms 3680 KiB
hand_21.txt AC 10 ms 3392 KiB
hand_22.txt WA 2 ms 3572 KiB
random_01.txt AC 2 ms 3680 KiB
random_02.txt AC 2 ms 3548 KiB
random_03.txt AC 2 ms 3468 KiB
random_04.txt AC 4 ms 3416 KiB
random_05.txt AC 2 ms 3564 KiB
sample_01.txt AC 2 ms 3552 KiB
sample_02.txt AC 2 ms 3540 KiB
sample_03.txt AC 2 ms 3568 KiB
sample_04.txt AC 2 ms 3392 KiB
sample_05.txt AC 2 ms 3552 KiB