Submission #288581

# Submission time Handle Problem Language Result Execution time Memory
288581 2020-09-01T16:18:11 Z DanerZein Vision Program (IOI19_vision) C++14
12 / 100
12 ms 3584 KB
#include "vision.h"
#include <bits/stdc++.h>
#define MAX 1000000000
using namespace std;
typedef pair<int,int> ii;
void construct_network(int H, int W, int K) {
  map<ii,int> m;
  vector<int> res;
  int c=0;
  int mi=MAX;
  int ma=-MAX;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      m[ii(i,j)]=c;
      c++;
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      vector<int> pos;
      pos.push_back(m[ii(i,j)]);
      int x=j+K;
      int y=i;
      //cout<<i<<" "<<j<<'\n';
      //cout<<"right:\n";
      while(true){
	if(x<j) break;
	if(x<W and y<H){
	  pos.push_back(m[ii(y,x)]);
	  //  cout<<y<<" "<<x<<" "<<m[ii(y,x)]<<endl;
	}
	x--;
	y++;
      }
      int id=add_xor(pos);
      mi=min(mi,id);
      ma=max(ma,id);
      id=add_or(pos);
      mi=min(mi,id);
      ma=max(ma,id);
      x=j-K;
      y=i;
      pos.clear();
      pos.push_back(m[ii(i,j)]);
      //cout<<"left:\n";
      while(true){
	if(x>=j) break;
	if(x>=0 and y<H){
	  pos.push_back(m[ii(y,x)]);
	  //cout<<y<<" "<<x<<" "<<m[ii(y,x)]<<endl;
	}
	x++;
	y++;
      }
      // cout<<endl;
      id=add_xor(pos);
      mi=min(mi,id);
      ma=max(ma,id);
      id=add_or(pos);
      mi=min(mi,id);
      ma=max(ma,id);
    }
  }
  int mai=-MAX;
  //cout<<mi<<" "<<ma<<endl;
  for(int i=mi;i<=ma;i+=2){
    vector<int>pos;
    pos.push_back(i);
    pos.push_back(i+1);
    int id=add_xor(pos);
    mai=max(mai,id);
  }
  vector<int> pos;
  for(int i=ma+1;i<=mai;i++){
    pos.push_back(i);
  }
  int id=add_or(pos);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:77:7: warning: unused variable 'id' [-Wunused-variable]
   77 |   int id=add_or(pos);
      |       ^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 416 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 4 ms 1276 KB WA in grader: Too many instructions
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 3584 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -