답안 #867311

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
867311 2023-10-28T07:04:30 Z Reyam Matching (COCI20_matching) C++14
5 / 110
0 ms 456 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define fix fixed<<setprecision(20)
#define endl'\n'
#define c(x) cout<<x<<endl
#define int ll
 //int a[200090],pre[200090],suf[200090];
 int mx[]={0,0,-1,1},my[]={-1,1,0,0};
 int a[600][600];
 bool vis[200][200];
 int n,m;
 bool inside(int i,int j){
 return (i&&i<=n&&j&&j<=m);
    }
    void dfs (int i,int j){
        vis[i][j]=1;
        for(int k=0;k<4;k++){
            int nx=i+mx[k],ny=j+my[k];
            if(inside(nx,ny)&& !vis[nx][ny]&& a[nx][ny]=='*') { vis[nx][ny]=1;
            dfs(nx,ny);}
        }
    }

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  cin>>n;
  vector<pair<int,int>> v;
  map< pair<int,int>,int>mp;
  for(int i=1;i<=n;i++){
        int x,y;
        cin>>x>>y;
        v.pb({x,y});
        mp[{x,y}]=i;
  }
  sort(v.begin(),v.end());
  int cnt=0;
  cout<<"DA"<<endl;
  for(auto x:v){
    cout<<mp[{x.first,x.second}];

    if(cnt%2) cout<<endl;
    else cout<<" " ;
    cnt++;
  }
}

Compilation message

matching.cpp:7:9: warning: ISO C++11 requires whitespace after the macro name
    7 | #define endl'\n'
      |         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -