URI Online Judge Solution 1025 Where is the Marble?  – Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1025 Where is the Marble? | Beginner
URI Problem Link – https://www.urionlinejudge.com.br/judge/en/problems/view/1025

Problem Name: 1025 Where is the Marble code
Problem Number : URI – 1025 Where is the Marble solution
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)

URI 1025 problem simple input output:

Input Sample Output Sample
4 1
2
3
5
1
5
5 2
1
3
3
3
1
2
3
0 0
CASE# 1:
5 found at 4
CASE# 2:
2 not found
3 found at 3

URI Solution 1025 Where is the Marble? Code in C++ / URI 1025 in CPP:

#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
int n, q, x, cases = 1, sizeR;
vector<int> m; vector<int> r;
pair<vector<int>::iterator, vector<int>::iterator> it;

while(scanf("%i %i", &n, &q) && (n || q))
{
m.clear(); r.clear();

for (int i = 0; i < n; ++i)
{
scanf("%i", &x);
m.push_back(x);
}

for (int i = 0; i < q; ++i)
{
scanf("%i", &x);
r.push_back(x);
}

sort(m.begin(), m.end());
printf("CASE# %i:n", cases);
sizeR = r.size();

for (int i = 0; i < sizeR; ++i)
{
if(binary_search(m.begin(), m.end(), r[i])){
it = equal_range(m.begin(), m.end(), r[i]);
printf("%i found at %lin", r[i], (it.first - m.begin()) + 1);
//std::cout <<resultados[a]<<" found at "<< (it.first - marmores.begin())+1<<endl;
}else{
printf("%i not foundn", r[i]);
//cout <<resultados[a]<<" not found"<<endl;
}
}

cases++;
}

return 0;
}

URI Solution 1025 Where is the Marble? Code / URI 1025solution in CPP:

URI Solution 1025 Where is the Marble? Code / URI 1025solution in Java:

URI Solution 1025 Where is the Marble? Code / URI 1025solution in  Python:

URI Solution 1025 Where is the Marble? Code / URI 1025solution in  C# (C Sharp):

Demonstration:

Just implement this in coding. Since having any problem just put a comment below. Thanks

Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI 1025 Where is the Marble?  code in C, URI 1025 Where is the Marble? code in C++, URI 1025 Where is the Marble?  solution in C, URI solution, URI 1025 Where is the Marble? solution in C,URI 1025 Where is the Marble? solution in C++-CPP,URI 1025 Where is the Marble? solution in C# (C sharp),URI 1025 Where is the Marble? solution in Java,URI 1025 Where is the Marble? solution in Python,

By Maniruzzaman Akash

Maniruzzaman Akash is a freelance web developer with most popular Laravel PHP frameork and Vue JS

Leave a Reply

Your email address will not be published. Required fields are marked *