답안 #266912

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
266912 2020-08-15T14:13:04 Z wdjpng Count Squares (CEOI19_countsquares) C++17
0 / 100
1 ms 256 KB
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define int long long
using namespace std;

signed main(){
    int n, m;
    vector<int>ver(n);
    vector<int>hor(n);

    rep(i,n){cin>>ver[i];}
    rep(i,m){cin>>hor[i];}

    map<int, int>vertDif;
    map<int, int>horDif;
    rep(i, n){
        for(int j=i+1; j<n; i++){
            vertDif[ver[j]-ver[i]]++;
        }
    }

    rep(i, m){
        for(int j=i+1; j<m; i++){
            horDif[hor[j]-hor[i]]++;
        }
    }

    int sum=0;
    for(auto k : vertDif){
        sum+=k.second*horDif[k.first];
    }

    cout<<sum;
}

Compilation message

countsquares.cpp: In function 'int main()':
countsquares.cpp:9:21: warning: 'n' is used uninitialized in this function [-Wuninitialized]
    9 |     vector<int>ver(n);
      |                     ^
countsquares.cpp:3:35: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
    3 | #define rep(i,n) for(int i = 0; i < n; i++)
      |                                   ^
countsquares.cpp:8:12: note: 'm' was declared here
    8 |     int n, m;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -