MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

CodeChef_problems/A Problem on Sticks/Solution.cpp:6–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using namespace std;
5
6int main() {
7 int t;//number of test cases
8 cin>>t;
9 while(t--){
10 int n;//input the number of sticks
11 cin>>n;
12 int a[n],i;// for each valid i, the initial height of the stick in the i-th holder is A[i]
13 set<int>s;
14 for( i=0;i<n;i++){// for each stick
15 cin>>a[i];
16 }
17 for( i=0;i<n;i++){
18 if(a[i]!=0){
19 s.insert(a[i]);// avoid all those height which is repeated
20 }
21
22 }
23
24 cout<<s.size()<<endl;//print the size of set
25 }
26
27 return 0;
28}

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected