Submission #130089

#TimeUsernameProblemLanguageResultExecution timeMemory
130089MohamedAhmed04Brunhilda’s Birthday (BOI13_brunhilda)C++14
0 / 100
365 ms262148 KiB
//WA submission to check if it will TLE or not.
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 1e7 + 5 ;
const int OO = 1e9 ;

int dp[MAX] ;

vector< vector<int> >d(MAX) ;

int main()
{
	int n , q ;
	scanf("%d %d" , &n , &q) ;
	int arr[n] ;
	for(int i = 0 ; i < n ; ++i)
	{
		scanf("%d" , &arr[i]) ;
		for(int j = arr[i] ; j < MAX ; j += arr[i])
			d[j].push_back(arr[i]) ;
	}
	dp[0] = 0 ;
	for(int i = 1 ; i < MAX ; ++i)
	{
		dp[i] = 0 ; 
		for(auto &j : d[i])
			dp[i] += j / 2;
	}
	while(q--)
	{
		int x ;
		scanf("%d" , &x) ;
		if(dp[x] >= OO)
			cout<<"oo\n" ;
		else
			cout<<dp[x]<<"\n";
	}
	return 0 ;
}

Compilation message (stderr)

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d" , &n , &q) ;
  ~~~~~^~~~~~~~~~~~~~~~~~~
brunhilda.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d" , &arr[i]) ;
   ~~~~~^~~~~~~~~~~~~~~~
brunhilda.cpp:34:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d" , &x) ;
   ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...