Submission #628685

# Submission time Handle Problem Language Result Execution time Memory
628685 2022-08-13T15:24:35 Z a_aguilo Fancy Fence (CEOI20_fancyfence) C++14
Compilation error
0 ms 0 KB
using namespace std;

int MOD = 1e9 + 7;

int main(){
    int n, h, w;
    cin >> n;
    long long int H = 0;
    for(int i = 0; i < n; ++i){
        cin >> H;
    }
    long long int W = 0;
    for(int i = 0; i < n; ++i){
        cin >> w;
        W += w;
        W%=MOD;
    }
    long long chooseh = (H*(H+1)/2)%MOD;
    long long choosew = (W*(W+1)/2)%MOD;
    cout << (chooseh*choosew)%MOD << endl;
    return 0;
}

Compilation message

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> n;
      |     ^~~
fancyfence.cpp:1:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
  +++ |+#include <iostream>
    1 | 
fancyfence.cpp:21:5: error: 'cout' was not declared in this scope
   21 |     cout << (chooseh*choosew)%MOD << endl;
      |     ^~~~
fancyfence.cpp:21:5: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
fancyfence.cpp:21:38: error: 'endl' was not declared in this scope
   21 |     cout << (chooseh*choosew)%MOD << endl;
      |                                      ^~~~
fancyfence.cpp:1:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
  +++ |+#include <ostream>
    1 | 
fancyfence.cpp:7:12: warning: unused variable 'h' [-Wunused-variable]
    7 |     int n, h, w;
      |            ^