Watscore help

can anyone help me in the solution why 2nd line is inserted and what is the use of it ??


You mean #define ll long long ?

It is to use “ll” as shortcut instead of writing “long long” in many places. Hope it helps!

Thanks @mnithinkk

Yeah what is the use of long long ?
Is it an data type or what ? Can you elaborate the use of it ?

Imagine, you have to write a program dealing with large numbers.

int datatype will fail, so you gotta use long long or maybe unsigned long long.

So, instead of writing, the entire data type everywhere in your code, we define it as macro in the top of our program and use the short name in our code, have clean codes.

1 Like

Helpful @nuttela
Got it .

1 Like

To expand on this - an int data type might overflow where a long long might not. For example, try running the following (C++14) program:

#include <iostream>
#include <queue>

using namespace std;

using ll = long long;

int main(){
        const int N = 90'000;
        const int numWaysOfChoosingPairs = (N * (N - 1)) / 2;
        cout << "Num ways of choosing a pair from " << N << " items (as an int): " << numWaysOfChoosingPairs << endl;
        const ll N = 90'000;
        const ll numWaysOfChoosingPairs = (N * (N - 1)) / 2;
        cout << "Num ways of choosing a pair from " << N << " items (as a long long): " << numWaysOfChoosingPairs << endl;


I made the ugliest code LOL

	public static void main (String[] args) throws java.lang.Exception
		// your code goes here
		Reader in = new Reader();
		int t = in.nextInt();
		for(int i=0;i<t;i++) {
		    int n=in.nextInt();
		    int count=0;
		    int max1=0;
		    int max2=0;
		    int max3=0;
		    int max4=0;
		    int max5=0;
		    int max6=0;
		    int max7=0;
		    int max8=0;
		    for (int j=0;j<n;j++) {
		        int p=in.nextInt();
		        int s=in.nextInt();
		        if (p==1 && s>max1) max1=s;
		        if (p==2 && s>max2) max2=s;
		        if (p==3 && s>max3) max3=s;
		        if (p==4 && s>max4) max4=s;
		        if (p==5 && s>max5) max5=s;
		        if (p==6 && s>max6) max6=s;
		        if (p==7 && s>max7) max7=s;
		        if (p==8 && s>max8) max8=s;

Better demonstration :smiley:

1 Like

You will learn eventually.
The more you code, the better it gets :stuck_out_tongue:

1 Like

I could’ve made an array but I decided to code ugly lol (idk why i just did)

Thanks for the support :+1:
and for your concern …:heart:


Problem Code:WATSCORE

This is my first problem and I’m stuck.
When I submit I’m getting the result: WA, but when I try custom input it is working. Help me.

def uni():
    global uniprob
    for i in list:
    uniprob = set(uniprob)
class Test:        
    def __init__(self):
    tcase = input()
    tcase = int(tcase)
    for _ in range(tcase):
        uniprob =[]
        submis = int(input())
        for i in range(submis):
        for k in uniprob:
            for i in list:
                if i.score>maxm and i.prob_num==k:
                    maxm = i.score
            finalres = finalres+maxm