Submission #499417

# Submission time Handle Problem Language Result Execution time Memory
499417 2021-12-28T11:30:28 Z Rande Ljeto (COCI21_ljeto) C++14
0 / 50
1 ms 204 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
        int n;
        cin>>n;
        int c1=0;
        int c2=0;
        int tt,aa,bb;
        int i,ii;
        int r,rr;
        cin>>tt>>aa>>bb;
        if(aa<=4){
          c1+=100;
          i=tt;
          r=aa;
        }
        else if(aa>=5){
          c2+=100;
          ii=tt;
          rr=aa;
        }
        for(int j=1;j<n;j++){
          int t,a,b;
          cin>>t>>a>>b;
          if(a<=4){
          if(abs(i-t)<=10&&a==r){
            c1+=150;
            i=t;
          }
          else if(a!=r){
            c1+=100;
            i=t;
          }
          r=a;
        }
        else if(a>=5){
           if(abs(ii-t)<=10&&a==rr){
            c2+=150;
            ii=t;
          }
           else if(a!=rr){
            c2+=100;
            ii=t;
            rr=a;
}
}
}
cout<<c1<<" " <<c2<<endl;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:42:17: warning: 'rr' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |            else if(a!=rr){
      |                 ^~
Main.cpp:27:26: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |           if(abs(i-t)<=10&&a==r){
      |              ~~~~~~~~~~~~^~~~~~
Main.cpp:38:21: warning: 'ii' may be used uninitialized in this function [-Wmaybe-uninitialized]
   38 |            if(abs(ii-t)<=10&&a==rr){
      |                   ~~^~
Main.cpp:27:19: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |           if(abs(i-t)<=10&&a==r){
      |                  ~^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct