fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n,x=0,y=0,z=0,temp;
  6. cin>>n;
  7. while(n--){
  8. temp = x;
  9. cin>>x;
  10. x = x+temp;
  11. temp = y;
  12. cin>>y;
  13. y+=temp;
  14. temp = z;
  15. cin>>z;
  16. z+=temp;
  17. }
  18. if(!x&&!y&&!z)
  19. cout<<"YES";
  20. else
  21. cout<<"NO";
  22. }
Success #stdin #stdout 0s 4252KB
stdin
3
3 -1 7
-5 2 -4
2 -1 -3
stdout
YES