結果

問題 No.1121 Social Distancing in Cinema
ユーザー KKT89
提出日時 2020-07-22 21:41:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 850 bytes
コンパイル時間 1,030 ms
コンパイル使用メモリ 111,724 KB
最終ジャッジ日時 2025-01-12 02:26:35
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:37:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
   37 |     printf("%d\n",res.size());
      |             ~^    ~~~~~~~~~~
      |              |            |
      |              int          std::vector<int>::size_type {aka long unsigned int}
      |             %ld

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

vector<int> v[5000];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> x(n),y(n);
    for(int i=0;i<n;i++){
        cin >> x[i] >> y[i];
        int nx=(x[i]-1)/9;
        int ny=(y[i]-1)/9;
        v[nx*60+ny].push_back(i+1);
    }
    vector<int> res;
    for(int i=0;i<5000;i++){
        if(v[i].size()){
            res.push_back(v[i][0]);
        }
    }
    printf("%d\n",res.size());
    for(int i=0;i<res.size();i++){
        printf("%d ",res[i]);
    }
    printf("\n");
}
0